Generated by Cython 3.0.5
Yellow lines hint at Python interaction.
Click on a line that starts with a "+" to see the C code that Cython generated for it.
Raw output: clm.c
+0001: # cython: c_string_type=unicode
__pyx_t_42 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_42)) __PYX_ERR(0, 1, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_42); if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_42) < 0) __PYX_ERR(0, 1, __pyx_L1_error) __Pyx_DECREF(__pyx_t_42); __pyx_t_42 = 0;
0002: # cython: c_string_encoding=utf8
0003:
+0004: import ctypes
__pyx_t_43 = __Pyx_ImportDottedModule(__pyx_n_s_ctypes, NULL); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 4, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_43); if (PyDict_SetItem(__pyx_d, __pyx_n_s_ctypes, __pyx_t_43) < 0) __PYX_ERR(0, 4, __pyx_L1_error) __Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
0005: #from functools import singledispatch, partial
+0006: import functools
__pyx_t_43 = __Pyx_ImportDottedModule(__pyx_n_s_functools, NULL); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 6, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_43); if (PyDict_SetItem(__pyx_d, __pyx_n_s_functools, __pyx_t_43) < 0) __PYX_ERR(0, 6, __pyx_L1_error) __Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
+0007: import math
__pyx_t_43 = __Pyx_ImportDottedModule(__pyx_n_s_math, NULL); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 7, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_43); if (PyDict_SetItem(__pyx_d, __pyx_n_s_math, __pyx_t_43) < 0) __PYX_ERR(0, 7, __pyx_L1_error) __Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
+0008: import random
__pyx_t_43 = __Pyx_ImportDottedModule(__pyx_n_s_random, NULL); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 8, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_43); if (PyDict_SetItem(__pyx_d, __pyx_n_s_random, __pyx_t_43) < 0) __PYX_ERR(0, 8, __pyx_L1_error) __Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
+0009: import subprocess
__pyx_t_43 = __Pyx_ImportDottedModule(__pyx_n_s_subprocess, NULL); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 9, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_43); if (PyDict_SetItem(__pyx_d, __pyx_n_s_subprocess, __pyx_t_43) < 0) __PYX_ERR(0, 9, __pyx_L1_error) __Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
+0010: import tempfile
__pyx_t_43 = __Pyx_ImportDottedModule(__pyx_n_s_tempfile, NULL); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 10, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_43); if (PyDict_SetItem(__pyx_d, __pyx_n_s_tempfile, __pyx_t_43) < 0) __PYX_ERR(0, 10, __pyx_L1_error) __Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
+0011: import time
__pyx_t_43 = __Pyx_ImportDottedModule(__pyx_n_s_time, NULL); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 11, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_43); if (PyDict_SetItem(__pyx_d, __pyx_n_s_time, __pyx_t_43) < 0) __PYX_ERR(0, 11, __pyx_L1_error) __Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
+0012: import types
__pyx_t_43 = __Pyx_ImportDottedModule(__pyx_n_s_types, NULL); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 12, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_43); if (PyDict_SetItem(__pyx_d, __pyx_n_s_types, __pyx_t_43) < 0) __PYX_ERR(0, 12, __pyx_L1_error) __Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
0013: import cython
0014: from cython.cimports.cpython.mem import PyMem_Malloc, PyMem_Realloc, PyMem_Free
0015: from cython cimport view
+0016: import numpy as np
__pyx_t_43 = __Pyx_ImportDottedModule(__pyx_n_s_numpy, NULL); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 16, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_43); if (PyDict_SetItem(__pyx_d, __pyx_n_s_np, __pyx_t_43) < 0) __PYX_ERR(0, 16, __pyx_L1_error) __Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
0017: cimport numpy as np
+0018: import numpy.typing as npt
__pyx_t_43 = __Pyx_ImportDottedModule(__pyx_n_s_numpy_typing, __pyx_tuple__109); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 18, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_43); if (PyDict_SetItem(__pyx_d, __pyx_n_s_npt, __pyx_t_43) < 0) __PYX_ERR(0, 18, __pyx_L1_error) __Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0; /* … */ __pyx_tuple__109 = PyTuple_Pack(2, __pyx_n_s_numpy, __pyx_n_s_typing); if (unlikely(!__pyx_tuple__109)) __PYX_ERR(0, 18, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__109); __Pyx_GIVEREF(__pyx_tuple__109);
0019: cimport pysndlib.cclm as cclm
0020: cimport pysndlib.csndlib as csndlib
+0021: from pysndlib.sndlib import Sample, Header
__pyx_t_43 = PyList_New(2); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 21, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_43); __Pyx_INCREF(__pyx_n_s_Sample); __Pyx_GIVEREF(__pyx_n_s_Sample); if (__Pyx_PyList_SET_ITEM(__pyx_t_43, 0, __pyx_n_s_Sample)) __PYX_ERR(0, 21, __pyx_L1_error); __Pyx_INCREF(__pyx_n_s_Header); __Pyx_GIVEREF(__pyx_n_s_Header); if (__Pyx_PyList_SET_ITEM(__pyx_t_43, 1, __pyx_n_s_Header)) __PYX_ERR(0, 21, __pyx_L1_error); __pyx_t_41 = __Pyx_Import(__pyx_n_s_pysndlib_sndlib, __pyx_t_43, 0); if (unlikely(!__pyx_t_41)) __PYX_ERR(0, 21, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_41); __Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0; __pyx_t_43 = __Pyx_ImportFrom(__pyx_t_41, __pyx_n_s_Sample); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 21, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_43); if (PyDict_SetItem(__pyx_d, __pyx_n_s_Sample, __pyx_t_43) < 0) __PYX_ERR(0, 21, __pyx_L1_error) __Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0; __pyx_t_43 = __Pyx_ImportFrom(__pyx_t_41, __pyx_n_s_Header); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 21, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_43); if (PyDict_SetItem(__pyx_d, __pyx_n_s_Header, __pyx_t_43) < 0) __PYX_ERR(0, 21, __pyx_L1_error) __Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0; __Pyx_DECREF(__pyx_t_41); __pyx_t_41 = 0;
+0022: import sys
__pyx_t_41 = __Pyx_ImportDottedModule(__pyx_n_s_sys, NULL); if (unlikely(!__pyx_t_41)) __PYX_ERR(0, 22, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_41); if (PyDict_SetItem(__pyx_d, __pyx_n_s_sys, __pyx_t_41) < 0) __PYX_ERR(0, 22, __pyx_L1_error) __Pyx_DECREF(__pyx_t_41); __pyx_t_41 = 0;
+0023: import os
__pyx_t_41 = __Pyx_ImportDottedModule(__pyx_n_s_os, NULL); if (unlikely(!__pyx_t_41)) __PYX_ERR(0, 23, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_41); if (PyDict_SetItem(__pyx_d, __pyx_n_s_os, __pyx_t_41) < 0) __PYX_ERR(0, 23, __pyx_L1_error) __Pyx_DECREF(__pyx_t_41); __pyx_t_41 = 0;
0024: cimport pysndlib.clm
0025:
+0026: np.import_array()
__pyx_t_44 = __pyx_f_5numpy_import_array(); if (unlikely(__pyx_t_44 == ((int)-1))) __PYX_ERR(0, 26, __pyx_L1_error)
0027:
0028: # # --------------- clm enums ---------------- #
0029: # cpdef enum Interp:
0030: # """
0031: # various interpolation types
0032: # """
0033: # NONE, LINEAR,SINUSOIDAL, ALL_PASS, LAGRANGE, BEZIER, HERMITE
0034:
0035: # cpdef enum Window:
0036: # """
0037: # many useful windows
0038: # """
0039: # RECTANGULAR, HANN, WELCH, PARZEN, BARTLETT, HAMMING, BLACKMAN2, BLACKMAN3, BLACKMAN4, EXPONENTIAL, RIEMANN, KAISER, CAUCHY, POISSON, GAUSSIAN, TUKEY, DOLPH_CHEBYSHEV, HANN_POISSON, CONNES, SAMARAKI, ULTRASPHERICAL, BARTLETT_HANN, BOHMAN, FLAT_TOP, BLACKMAN5, BLACKMAN6, BLACKMAN7, BLACKMAN8, BLACKMAN9, BLACKMAN10, RV2, RV3, RV4, MLT_SINE, PAPOULIS, DPSS, SINC,
0040: #
0041: # cpdef enum Spectrum:
0042: # """
0043: # types of normalizations when using the spectrum function. The results are in dB if IN_DB, or linear and normalized to 1.0 NORMALIZED, or linear unnormalized RAW
0044: # """
0045: # IN_DB, NORMALIZED, RAW
0046: #
0047: # cpdef enum Polynomial:
0048: # """
0049: # used for polynomial based gens
0050: # """
0051: # EITHER_KIND, FIRST_KIND, SECOND_KIND, BOTH_KINDS
0052:
0053:
0054:
0055: # --------------- function types for ctypes ---------------- #
+0056: INPUTCALLBACK = ctypes.CFUNCTYPE(ctypes.c_double, ctypes.c_void_p, ctypes.c_int)
__Pyx_GetModuleGlobalName(__pyx_t_41, __pyx_n_s_ctypes); if (unlikely(!__pyx_t_41)) __PYX_ERR(0, 56, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_41); __pyx_t_43 = __Pyx_PyObject_GetAttrStr(__pyx_t_41, __pyx_n_s_CFUNCTYPE); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 56, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_43); __Pyx_DECREF(__pyx_t_41); __pyx_t_41 = 0; __Pyx_GetModuleGlobalName(__pyx_t_41, __pyx_n_s_ctypes); if (unlikely(!__pyx_t_41)) __PYX_ERR(0, 56, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_41); __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_41, __pyx_n_s_c_double); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 56, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_41); __pyx_t_41 = 0; __Pyx_GetModuleGlobalName(__pyx_t_41, __pyx_n_s_ctypes); if (unlikely(!__pyx_t_41)) __PYX_ERR(0, 56, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_41); __pyx_t_42 = __Pyx_PyObject_GetAttrStr(__pyx_t_41, __pyx_n_s_c_void_p); if (unlikely(!__pyx_t_42)) __PYX_ERR(0, 56, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_42); __Pyx_DECREF(__pyx_t_41); __pyx_t_41 = 0; __Pyx_GetModuleGlobalName(__pyx_t_41, __pyx_n_s_ctypes); if (unlikely(!__pyx_t_41)) __PYX_ERR(0, 56, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_41); __pyx_t_40 = __Pyx_PyObject_GetAttrStr(__pyx_t_41, __pyx_n_s_c_int); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 56, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_40); __Pyx_DECREF(__pyx_t_41); __pyx_t_41 = 0; __pyx_t_41 = PyTuple_New(3); if (unlikely(!__pyx_t_41)) __PYX_ERR(0, 56, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_41); __Pyx_GIVEREF(__pyx_t_10); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_41, 0, __pyx_t_10)) __PYX_ERR(0, 56, __pyx_L1_error); __Pyx_GIVEREF(__pyx_t_42); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_41, 1, __pyx_t_42)) __PYX_ERR(0, 56, __pyx_L1_error); __Pyx_GIVEREF(__pyx_t_40); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_41, 2, __pyx_t_40)) __PYX_ERR(0, 56, __pyx_L1_error); __pyx_t_10 = 0; __pyx_t_42 = 0; __pyx_t_40 = 0; __pyx_t_40 = __Pyx_PyObject_Call(__pyx_t_43, __pyx_t_41, NULL); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 56, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_40); __Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0; __Pyx_DECREF(__pyx_t_41); __pyx_t_41 = 0; if (PyDict_SetItem(__pyx_d, __pyx_n_s_INPUTCALLBACK, __pyx_t_40) < 0) __PYX_ERR(0, 56, __pyx_L1_error) __Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
+0057: EDITCALLBACK = ctypes.CFUNCTYPE(ctypes.c_int, ctypes.c_void_p)
__Pyx_GetModuleGlobalName(__pyx_t_40, __pyx_n_s_ctypes); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 57, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_40); __pyx_t_41 = __Pyx_PyObject_GetAttrStr(__pyx_t_40, __pyx_n_s_CFUNCTYPE); if (unlikely(!__pyx_t_41)) __PYX_ERR(0, 57, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_41); __Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0; __Pyx_GetModuleGlobalName(__pyx_t_40, __pyx_n_s_ctypes); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 57, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_40); __pyx_t_43 = __Pyx_PyObject_GetAttrStr(__pyx_t_40, __pyx_n_s_c_int); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 57, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_43); __Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0; __Pyx_GetModuleGlobalName(__pyx_t_40, __pyx_n_s_ctypes); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 57, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_40); __pyx_t_42 = __Pyx_PyObject_GetAttrStr(__pyx_t_40, __pyx_n_s_c_void_p); if (unlikely(!__pyx_t_42)) __PYX_ERR(0, 57, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_42); __Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0; __pyx_t_40 = PyTuple_New(2); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 57, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_40); __Pyx_GIVEREF(__pyx_t_43); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_40, 0, __pyx_t_43)) __PYX_ERR(0, 57, __pyx_L1_error); __Pyx_GIVEREF(__pyx_t_42); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_40, 1, __pyx_t_42)) __PYX_ERR(0, 57, __pyx_L1_error); __pyx_t_43 = 0; __pyx_t_42 = 0; __pyx_t_42 = __Pyx_PyObject_Call(__pyx_t_41, __pyx_t_40, NULL); if (unlikely(!__pyx_t_42)) __PYX_ERR(0, 57, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_42); __Pyx_DECREF(__pyx_t_41); __pyx_t_41 = 0; __Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0; if (PyDict_SetItem(__pyx_d, __pyx_n_s_EDITCALLBACK, __pyx_t_42) < 0) __PYX_ERR(0, 57, __pyx_L1_error) __Pyx_DECREF(__pyx_t_42); __pyx_t_42 = 0;
+0058: ANALYZECALLBACK = ctypes.CFUNCTYPE(ctypes.c_bool, ctypes.c_void_p, ctypes.CFUNCTYPE(ctypes.c_double, ctypes.c_void_p, ctypes.c_int))
__Pyx_GetModuleGlobalName(__pyx_t_42, __pyx_n_s_ctypes); if (unlikely(!__pyx_t_42)) __PYX_ERR(0, 58, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_42); __pyx_t_40 = __Pyx_PyObject_GetAttrStr(__pyx_t_42, __pyx_n_s_CFUNCTYPE); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 58, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_40); __Pyx_DECREF(__pyx_t_42); __pyx_t_42 = 0; __Pyx_GetModuleGlobalName(__pyx_t_42, __pyx_n_s_ctypes); if (unlikely(!__pyx_t_42)) __PYX_ERR(0, 58, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_42); __pyx_t_41 = __Pyx_PyObject_GetAttrStr(__pyx_t_42, __pyx_n_s_c_bool); if (unlikely(!__pyx_t_41)) __PYX_ERR(0, 58, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_41); __Pyx_DECREF(__pyx_t_42); __pyx_t_42 = 0; __Pyx_GetModuleGlobalName(__pyx_t_42, __pyx_n_s_ctypes); if (unlikely(!__pyx_t_42)) __PYX_ERR(0, 58, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_42); __pyx_t_43 = __Pyx_PyObject_GetAttrStr(__pyx_t_42, __pyx_n_s_c_void_p); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 58, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_43); __Pyx_DECREF(__pyx_t_42); __pyx_t_42 = 0; __Pyx_GetModuleGlobalName(__pyx_t_42, __pyx_n_s_ctypes); if (unlikely(!__pyx_t_42)) __PYX_ERR(0, 58, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_42); __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_42, __pyx_n_s_CFUNCTYPE); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 58, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_42); __pyx_t_42 = 0; __Pyx_GetModuleGlobalName(__pyx_t_42, __pyx_n_s_ctypes); if (unlikely(!__pyx_t_42)) __PYX_ERR(0, 58, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_42); __pyx_t_39 = __Pyx_PyObject_GetAttrStr(__pyx_t_42, __pyx_n_s_c_double); if (unlikely(!__pyx_t_39)) __PYX_ERR(0, 58, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_39); __Pyx_DECREF(__pyx_t_42); __pyx_t_42 = 0; __Pyx_GetModuleGlobalName(__pyx_t_42, __pyx_n_s_ctypes); if (unlikely(!__pyx_t_42)) __PYX_ERR(0, 58, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_42); __pyx_t_38 = __Pyx_PyObject_GetAttrStr(__pyx_t_42, __pyx_n_s_c_void_p); if (unlikely(!__pyx_t_38)) __PYX_ERR(0, 58, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_38); __Pyx_DECREF(__pyx_t_42); __pyx_t_42 = 0; __Pyx_GetModuleGlobalName(__pyx_t_42, __pyx_n_s_ctypes); if (unlikely(!__pyx_t_42)) __PYX_ERR(0, 58, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_42); __pyx_t_37 = __Pyx_PyObject_GetAttrStr(__pyx_t_42, __pyx_n_s_c_int); if (unlikely(!__pyx_t_37)) __PYX_ERR(0, 58, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_37); __Pyx_DECREF(__pyx_t_42); __pyx_t_42 = 0; __pyx_t_42 = PyTuple_New(3); if (unlikely(!__pyx_t_42)) __PYX_ERR(0, 58, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_42); __Pyx_GIVEREF(__pyx_t_39); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_42, 0, __pyx_t_39)) __PYX_ERR(0, 58, __pyx_L1_error); __Pyx_GIVEREF(__pyx_t_38); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_42, 1, __pyx_t_38)) __PYX_ERR(0, 58, __pyx_L1_error); __Pyx_GIVEREF(__pyx_t_37); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_42, 2, __pyx_t_37)) __PYX_ERR(0, 58, __pyx_L1_error); __pyx_t_39 = 0; __pyx_t_38 = 0; __pyx_t_37 = 0; __pyx_t_37 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_42, NULL); if (unlikely(!__pyx_t_37)) __PYX_ERR(0, 58, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_37); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __Pyx_DECREF(__pyx_t_42); __pyx_t_42 = 0; __pyx_t_42 = PyTuple_New(3); if (unlikely(!__pyx_t_42)) __PYX_ERR(0, 58, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_42); __Pyx_GIVEREF(__pyx_t_41); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_42, 0, __pyx_t_41)) __PYX_ERR(0, 58, __pyx_L1_error); __Pyx_GIVEREF(__pyx_t_43); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_42, 1, __pyx_t_43)) __PYX_ERR(0, 58, __pyx_L1_error); __Pyx_GIVEREF(__pyx_t_37); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_42, 2, __pyx_t_37)) __PYX_ERR(0, 58, __pyx_L1_error); __pyx_t_41 = 0; __pyx_t_43 = 0; __pyx_t_37 = 0; __pyx_t_37 = __Pyx_PyObject_Call(__pyx_t_40, __pyx_t_42, NULL); if (unlikely(!__pyx_t_37)) __PYX_ERR(0, 58, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_37); __Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0; __Pyx_DECREF(__pyx_t_42); __pyx_t_42 = 0; if (PyDict_SetItem(__pyx_d, __pyx_n_s_ANALYZECALLBACK, __pyx_t_37) < 0) __PYX_ERR(0, 58, __pyx_L1_error) __Pyx_DECREF(__pyx_t_37); __pyx_t_37 = 0;
+0059: SYNTHESIZECALLBACK = ctypes.CFUNCTYPE(ctypes.c_double, ctypes.c_void_p)
__Pyx_GetModuleGlobalName(__pyx_t_37, __pyx_n_s_ctypes); if (unlikely(!__pyx_t_37)) __PYX_ERR(0, 59, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_37); __pyx_t_42 = __Pyx_PyObject_GetAttrStr(__pyx_t_37, __pyx_n_s_CFUNCTYPE); if (unlikely(!__pyx_t_42)) __PYX_ERR(0, 59, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_42); __Pyx_DECREF(__pyx_t_37); __pyx_t_37 = 0; __Pyx_GetModuleGlobalName(__pyx_t_37, __pyx_n_s_ctypes); if (unlikely(!__pyx_t_37)) __PYX_ERR(0, 59, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_37); __pyx_t_40 = __Pyx_PyObject_GetAttrStr(__pyx_t_37, __pyx_n_s_c_double); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 59, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_40); __Pyx_DECREF(__pyx_t_37); __pyx_t_37 = 0; __Pyx_GetModuleGlobalName(__pyx_t_37, __pyx_n_s_ctypes); if (unlikely(!__pyx_t_37)) __PYX_ERR(0, 59, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_37); __pyx_t_43 = __Pyx_PyObject_GetAttrStr(__pyx_t_37, __pyx_n_s_c_void_p); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 59, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_43); __Pyx_DECREF(__pyx_t_37); __pyx_t_37 = 0; __pyx_t_37 = PyTuple_New(2); if (unlikely(!__pyx_t_37)) __PYX_ERR(0, 59, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_37); __Pyx_GIVEREF(__pyx_t_40); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_37, 0, __pyx_t_40)) __PYX_ERR(0, 59, __pyx_L1_error); __Pyx_GIVEREF(__pyx_t_43); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_37, 1, __pyx_t_43)) __PYX_ERR(0, 59, __pyx_L1_error); __pyx_t_40 = 0; __pyx_t_43 = 0; __pyx_t_43 = __Pyx_PyObject_Call(__pyx_t_42, __pyx_t_37, NULL); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 59, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_43); __Pyx_DECREF(__pyx_t_42); __pyx_t_42 = 0; __Pyx_DECREF(__pyx_t_37); __pyx_t_37 = 0; if (PyDict_SetItem(__pyx_d, __pyx_n_s_SYNTHESIZECALLBACK, __pyx_t_43) < 0) __PYX_ERR(0, 59, __pyx_L1_error) __Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
+0060: LOCSIGDETOURCALLBACK = ctypes.CFUNCTYPE(None, ctypes.c_void_p, ctypes.c_longlong)
__Pyx_GetModuleGlobalName(__pyx_t_43, __pyx_n_s_ctypes); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 60, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_43); __pyx_t_37 = __Pyx_PyObject_GetAttrStr(__pyx_t_43, __pyx_n_s_CFUNCTYPE); if (unlikely(!__pyx_t_37)) __PYX_ERR(0, 60, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_37); __Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0; __Pyx_GetModuleGlobalName(__pyx_t_43, __pyx_n_s_ctypes); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 60, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_43); __pyx_t_42 = __Pyx_PyObject_GetAttrStr(__pyx_t_43, __pyx_n_s_c_void_p); if (unlikely(!__pyx_t_42)) __PYX_ERR(0, 60, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_42); __Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0; __Pyx_GetModuleGlobalName(__pyx_t_43, __pyx_n_s_ctypes); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 60, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_43); __pyx_t_40 = __Pyx_PyObject_GetAttrStr(__pyx_t_43, __pyx_n_s_c_longlong); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 60, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_40); __Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0; __pyx_t_43 = PyTuple_New(3); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 60, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_43); __Pyx_INCREF(Py_None); __Pyx_GIVEREF(Py_None); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_43, 0, Py_None)) __PYX_ERR(0, 60, __pyx_L1_error); __Pyx_GIVEREF(__pyx_t_42); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_43, 1, __pyx_t_42)) __PYX_ERR(0, 60, __pyx_L1_error); __Pyx_GIVEREF(__pyx_t_40); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_43, 2, __pyx_t_40)) __PYX_ERR(0, 60, __pyx_L1_error); __pyx_t_42 = 0; __pyx_t_40 = 0; __pyx_t_40 = __Pyx_PyObject_Call(__pyx_t_37, __pyx_t_43, NULL); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 60, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_40); __Pyx_DECREF(__pyx_t_37); __pyx_t_37 = 0; __Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0; if (PyDict_SetItem(__pyx_d, __pyx_n_s_LOCSIGDETOURCALLBACK, __pyx_t_40) < 0) __PYX_ERR(0, 60, __pyx_L1_error) __Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
+0061: ENVFUNCTION = ctypes.CFUNCTYPE(ctypes.c_double, ctypes.c_double) # for env_any
__Pyx_GetModuleGlobalName(__pyx_t_40, __pyx_n_s_ctypes); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 61, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_40); __pyx_t_43 = __Pyx_PyObject_GetAttrStr(__pyx_t_40, __pyx_n_s_CFUNCTYPE); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 61, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_43); __Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0; __Pyx_GetModuleGlobalName(__pyx_t_40, __pyx_n_s_ctypes); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 61, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_40); __pyx_t_37 = __Pyx_PyObject_GetAttrStr(__pyx_t_40, __pyx_n_s_c_double); if (unlikely(!__pyx_t_37)) __PYX_ERR(0, 61, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_37); __Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0; __Pyx_GetModuleGlobalName(__pyx_t_40, __pyx_n_s_ctypes); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 61, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_40); __pyx_t_42 = __Pyx_PyObject_GetAttrStr(__pyx_t_40, __pyx_n_s_c_double); if (unlikely(!__pyx_t_42)) __PYX_ERR(0, 61, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_42); __Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0; __pyx_t_40 = PyTuple_New(2); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 61, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_40); __Pyx_GIVEREF(__pyx_t_37); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_40, 0, __pyx_t_37)) __PYX_ERR(0, 61, __pyx_L1_error); __Pyx_GIVEREF(__pyx_t_42); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_40, 1, __pyx_t_42)) __PYX_ERR(0, 61, __pyx_L1_error); __pyx_t_37 = 0; __pyx_t_42 = 0; __pyx_t_42 = __Pyx_PyObject_Call(__pyx_t_43, __pyx_t_40, NULL); if (unlikely(!__pyx_t_42)) __PYX_ERR(0, 61, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_42); __Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0; __Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0; if (PyDict_SetItem(__pyx_d, __pyx_n_s_ENVFUNCTION, __pyx_t_42) < 0) __PYX_ERR(0, 61, __pyx_L1_error) __Pyx_DECREF(__pyx_t_42); __pyx_t_42 = 0;
0062:
0063: #these may need to be set based on system type etc
+0064: DEFAULT_OUTPUT_SRATE = 44100
if (PyDict_SetItem(__pyx_d, __pyx_n_s_DEFAULT_OUTPUT_SRATE, __pyx_int_44100) < 0) __PYX_ERR(0, 64, __pyx_L1_error)
+0065: DEFAULT_OUTPUT_CHANS = 1
if (PyDict_SetItem(__pyx_d, __pyx_n_s_DEFAULT_OUTPUT_CHANS, __pyx_int_1) < 0) __PYX_ERR(0, 65, __pyx_L1_error)
0066:
0067:
0068:
+0069: DEFAULT_FILE_PLAYER = None
if (PyDict_SetItem(__pyx_d, __pyx_n_s_DEFAULT_FILE_PLAYER, Py_None) < 0) __PYX_ERR(0, 69, __pyx_L1_error)
0070:
+0071: if sys.platform.startswith("darwin"):
__Pyx_GetModuleGlobalName(__pyx_t_42, __pyx_n_s_sys); if (unlikely(!__pyx_t_42)) __PYX_ERR(0, 71, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_42); __pyx_t_40 = __Pyx_PyObject_GetAttrStr(__pyx_t_42, __pyx_n_s_platform); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 71, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_40); __Pyx_DECREF(__pyx_t_42); __pyx_t_42 = 0; __pyx_t_42 = __Pyx_PyObject_GetAttrStr(__pyx_t_40, __pyx_n_s_startswith); if (unlikely(!__pyx_t_42)) __PYX_ERR(0, 71, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_42); __Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0; __pyx_t_40 = __Pyx_PyObject_Call(__pyx_t_42, __pyx_tuple__110, NULL); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 71, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_40); __Pyx_DECREF(__pyx_t_42); __pyx_t_42 = 0; __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_40); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 71, __pyx_L1_error) __Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0; if (__pyx_t_2) { /* … */ } /* … */ __pyx_tuple__110 = PyTuple_Pack(1, __pyx_n_s_darwin); if (unlikely(!__pyx_tuple__110)) __PYX_ERR(0, 71, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__110); __Pyx_GIVEREF(__pyx_tuple__110);
+0072: DEFAULT_FILE_PLAYER = 'afplay'
if (PyDict_SetItem(__pyx_d, __pyx_n_s_DEFAULT_FILE_PLAYER, __pyx_n_s_afplay) < 0) __PYX_ERR(0, 72, __pyx_L1_error)
+0073: DEFAULT_FILE_NAME = 'test.wav'
if (PyDict_SetItem(__pyx_d, __pyx_n_s_DEFAULT_FILE_NAME, __pyx_kp_s_test_wav) < 0) __PYX_ERR(0, 73, __pyx_L1_error)
+0074: DEFAULT_OUTPUT_HEADER_TYPE = Header.RIFF
__Pyx_GetModuleGlobalName(__pyx_t_40, __pyx_n_s_Header); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 74, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_40); __pyx_t_42 = __Pyx_PyObject_GetAttrStr(__pyx_t_40, __pyx_n_s_RIFF); if (unlikely(!__pyx_t_42)) __PYX_ERR(0, 74, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_42); __Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0; if (PyDict_SetItem(__pyx_d, __pyx_n_s_DEFAULT_OUTPUT_HEADER_TYPE, __pyx_t_42) < 0) __PYX_ERR(0, 74, __pyx_L1_error) __Pyx_DECREF(__pyx_t_42); __pyx_t_42 = 0;
+0075: DEFAULT_OUTPUT_SAMPLE_TYPE = Sample.LFLOAT
__Pyx_GetModuleGlobalName(__pyx_t_42, __pyx_n_s_Sample); if (unlikely(!__pyx_t_42)) __PYX_ERR(0, 75, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_42); __pyx_t_40 = __Pyx_PyObject_GetAttrStr(__pyx_t_42, __pyx_n_s_LFLOAT); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 75, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_40); __Pyx_DECREF(__pyx_t_42); __pyx_t_42 = 0; if (PyDict_SetItem(__pyx_d, __pyx_n_s_DEFAULT_OUTPUT_SAMPLE_TYPE, __pyx_t_40) < 0) __PYX_ERR(0, 75, __pyx_L1_error) __Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
0076:
0077: # DEFAULT_OUTPUT_HEADER_TYPE = Header.AIFC
0078: # DEFAULT_OUTPUT_SAMPLE_TYPE = Sample.BFLOAT
0079:
+0080: if sys.platform.startswith("linux"):
__Pyx_GetModuleGlobalName(__pyx_t_40, __pyx_n_s_sys); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 80, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_40); __pyx_t_42 = __Pyx_PyObject_GetAttrStr(__pyx_t_40, __pyx_n_s_platform); if (unlikely(!__pyx_t_42)) __PYX_ERR(0, 80, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_42); __Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0; __pyx_t_40 = __Pyx_PyObject_GetAttrStr(__pyx_t_42, __pyx_n_s_startswith); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 80, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_40); __Pyx_DECREF(__pyx_t_42); __pyx_t_42 = 0; __pyx_t_42 = __Pyx_PyObject_Call(__pyx_t_40, __pyx_tuple__111, NULL); if (unlikely(!__pyx_t_42)) __PYX_ERR(0, 80, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_42); __Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0; __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_42); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 80, __pyx_L1_error) __Pyx_DECREF(__pyx_t_42); __pyx_t_42 = 0; if (__pyx_t_2) { /* … */ } /* … */ __pyx_tuple__111 = PyTuple_Pack(1, __pyx_n_s_linux); if (unlikely(!__pyx_tuple__111)) __PYX_ERR(0, 80, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__111); __Pyx_GIVEREF(__pyx_tuple__111);
+0081: DEFAULT_FILE_PLAYER = 'aplay'
if (PyDict_SetItem(__pyx_d, __pyx_n_s_DEFAULT_FILE_PLAYER, __pyx_n_s_aplay) < 0) __PYX_ERR(0, 81, __pyx_L1_error)
+0082: DEFAULT_FILE_NAME = 'test.wav'
if (PyDict_SetItem(__pyx_d, __pyx_n_s_DEFAULT_FILE_NAME, __pyx_kp_s_test_wav) < 0) __PYX_ERR(0, 82, __pyx_L1_error)
+0083: DEFAULT_OUTPUT_HEADER_TYPE = Header.RIFF
__Pyx_GetModuleGlobalName(__pyx_t_42, __pyx_n_s_Header); if (unlikely(!__pyx_t_42)) __PYX_ERR(0, 83, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_42); __pyx_t_40 = __Pyx_PyObject_GetAttrStr(__pyx_t_42, __pyx_n_s_RIFF); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 83, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_40); __Pyx_DECREF(__pyx_t_42); __pyx_t_42 = 0; if (PyDict_SetItem(__pyx_d, __pyx_n_s_DEFAULT_OUTPUT_HEADER_TYPE, __pyx_t_40) < 0) __PYX_ERR(0, 83, __pyx_L1_error) __Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
+0084: DEFAULT_OUTPUT_SAMPLE_TYPE = Sample.LFLOAT
__Pyx_GetModuleGlobalName(__pyx_t_40, __pyx_n_s_Sample); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 84, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_40); __pyx_t_42 = __Pyx_PyObject_GetAttrStr(__pyx_t_40, __pyx_n_s_LFLOAT); if (unlikely(!__pyx_t_42)) __PYX_ERR(0, 84, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_42); __Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0; if (PyDict_SetItem(__pyx_d, __pyx_n_s_DEFAULT_OUTPUT_SAMPLE_TYPE, __pyx_t_42) < 0) __PYX_ERR(0, 84, __pyx_L1_error) __Pyx_DECREF(__pyx_t_42); __pyx_t_42 = 0;
0085:
0086: # --------------- main clm prefs ---------------- #
0087:
+0088: CLM = types.SimpleNamespace(
__Pyx_GetModuleGlobalName(__pyx_t_42, __pyx_n_s_types); if (unlikely(!__pyx_t_42)) __PYX_ERR(0, 88, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_42); __pyx_t_40 = __Pyx_PyObject_GetAttrStr(__pyx_t_42, __pyx_n_s_SimpleNamespace); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 88, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_40); __Pyx_DECREF(__pyx_t_42); __pyx_t_42 = 0; /* … */ __pyx_t_43 = __Pyx_PyObject_Call(__pyx_t_40, __pyx_empty_tuple, __pyx_t_42); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 88, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_43); __Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0; __Pyx_DECREF(__pyx_t_42); __pyx_t_42 = 0; if (PyDict_SetItem(__pyx_d, __pyx_n_s_CLM, __pyx_t_43) < 0) __PYX_ERR(0, 88, __pyx_L1_error) __Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
+0089: file_name = DEFAULT_FILE_NAME,
__pyx_t_42 = __Pyx_PyDict_NewPresized(19); if (unlikely(!__pyx_t_42)) __PYX_ERR(0, 89, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_42); __Pyx_GetModuleGlobalName(__pyx_t_43, __pyx_n_s_DEFAULT_FILE_NAME); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 89, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_43); if (PyDict_SetItem(__pyx_t_42, __pyx_n_s_file_name, __pyx_t_43) < 0) __PYX_ERR(0, 89, __pyx_L1_error) __Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
+0090: srate = DEFAULT_OUTPUT_SRATE,
__Pyx_GetModuleGlobalName(__pyx_t_43, __pyx_n_s_DEFAULT_OUTPUT_SRATE); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 90, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_43); if (PyDict_SetItem(__pyx_t_42, __pyx_n_s_srate, __pyx_t_43) < 0) __PYX_ERR(0, 89, __pyx_L1_error) __Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
+0091: channels = DEFAULT_OUTPUT_CHANS,
__Pyx_GetModuleGlobalName(__pyx_t_43, __pyx_n_s_DEFAULT_OUTPUT_CHANS); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 91, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_43); if (PyDict_SetItem(__pyx_t_42, __pyx_n_s_channels, __pyx_t_43) < 0) __PYX_ERR(0, 89, __pyx_L1_error) __Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
+0092: sample_type = DEFAULT_OUTPUT_SAMPLE_TYPE,
__Pyx_GetModuleGlobalName(__pyx_t_43, __pyx_n_s_DEFAULT_OUTPUT_SAMPLE_TYPE); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 92, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_43); if (PyDict_SetItem(__pyx_t_42, __pyx_n_s_sample_type, __pyx_t_43) < 0) __PYX_ERR(0, 89, __pyx_L1_error) __Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
+0093: header_type = DEFAULT_OUTPUT_HEADER_TYPE,
__Pyx_GetModuleGlobalName(__pyx_t_43, __pyx_n_s_DEFAULT_OUTPUT_HEADER_TYPE); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 93, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_43); if (PyDict_SetItem(__pyx_t_42, __pyx_n_s_header_type, __pyx_t_43) < 0) __PYX_ERR(0, 89, __pyx_L1_error) __Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
+0094: player = DEFAULT_FILE_PLAYER,
__Pyx_GetModuleGlobalName(__pyx_t_43, __pyx_n_s_DEFAULT_FILE_PLAYER); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 94, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_43); if (PyDict_SetItem(__pyx_t_42, __pyx_n_s_player, __pyx_t_43) < 0) __PYX_ERR(0, 89, __pyx_L1_error) __Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
+0095: verbose = False,
if (PyDict_SetItem(__pyx_t_42, __pyx_n_s_verbose, Py_False) < 0) __PYX_ERR(0, 89, __pyx_L1_error)
+0096: play = False,
if (PyDict_SetItem(__pyx_t_42, __pyx_n_s_play, Py_False) < 0) __PYX_ERR(0, 89, __pyx_L1_error)
+0097: statistics = False,
if (PyDict_SetItem(__pyx_t_42, __pyx_n_s_statistics, Py_False) < 0) __PYX_ERR(0, 89, __pyx_L1_error)
+0098: reverb = None,
if (PyDict_SetItem(__pyx_t_42, __pyx_n_s_reverb, Py_None) < 0) __PYX_ERR(0, 89, __pyx_L1_error) if (PyDict_SetItem(__pyx_t_42, __pyx_n_s_reverb_channels, __pyx_int_1) < 0) __PYX_ERR(0, 89, __pyx_L1_error)
0099: reverb_channels = 1,
+0100: reverb_data = None,
if (PyDict_SetItem(__pyx_t_42, __pyx_n_s_reverb_data, Py_None) < 0) __PYX_ERR(0, 89, __pyx_L1_error) if (PyDict_SetItem(__pyx_t_42, __pyx_n_s_reverb_file_name, __pyx_kp_s_test_rev) < 0) __PYX_ERR(0, 89, __pyx_L1_error) if (PyDict_SetItem(__pyx_t_42, __pyx_n_s_table_size, __pyx_int_512) < 0) __PYX_ERR(0, 89, __pyx_L1_error) if (PyDict_SetItem(__pyx_t_42, __pyx_n_s_buffer_size, __pyx_int_65536) < 0) __PYX_ERR(0, 89, __pyx_L1_error)
0101: reverb_file_name = 'test.rev',
0102: table_size = 512,
0103: buffer_size = 65536,
+0104: locsig_type = Interp.LINEAR,
__pyx_t_43 = __Pyx_Enum_Interp_to_py(__pyx_e_8pysndlib_3clm_LINEAR); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 104, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_43); if (PyDict_SetItem(__pyx_t_42, __pyx_n_s_locsig_type, __pyx_t_43) < 0) __PYX_ERR(0, 89, __pyx_L1_error) __Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
+0105: clipped = False,
if (PyDict_SetItem(__pyx_t_42, __pyx_n_s_clipped, Py_False) < 0) __PYX_ERR(0, 89, __pyx_L1_error)
+0106: output = False,
if (PyDict_SetItem(__pyx_t_42, __pyx_n_s_output, Py_False) < 0) __PYX_ERR(0, 89, __pyx_L1_error)
+0107: delete_reverb = False
if (PyDict_SetItem(__pyx_t_42, __pyx_n_s_delete_reverb, Py_False) < 0) __PYX_ERR(0, 89, __pyx_L1_error)
0108: )
0109:
0110:
+0111: if os.path.exists(os.path.expanduser('~/.pysndlib')):
__Pyx_GetModuleGlobalName(__pyx_t_43, __pyx_n_s_os); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 111, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_43); __pyx_t_42 = __Pyx_PyObject_GetAttrStr(__pyx_t_43, __pyx_n_s_path); if (unlikely(!__pyx_t_42)) __PYX_ERR(0, 111, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_42); __Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0; __pyx_t_43 = __Pyx_PyObject_GetAttrStr(__pyx_t_42, __pyx_n_s_exists); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 111, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_43); __Pyx_DECREF(__pyx_t_42); __pyx_t_42 = 0; __Pyx_GetModuleGlobalName(__pyx_t_42, __pyx_n_s_os); if (unlikely(!__pyx_t_42)) __PYX_ERR(0, 111, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_42); __pyx_t_40 = __Pyx_PyObject_GetAttrStr(__pyx_t_42, __pyx_n_s_path); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 111, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_40); __Pyx_DECREF(__pyx_t_42); __pyx_t_42 = 0; __pyx_t_42 = __Pyx_PyObject_GetAttrStr(__pyx_t_40, __pyx_n_s_expanduser); if (unlikely(!__pyx_t_42)) __PYX_ERR(0, 111, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_42); __Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0; __pyx_t_40 = __Pyx_PyObject_Call(__pyx_t_42, __pyx_tuple__112, NULL); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 111, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_40); __Pyx_DECREF(__pyx_t_42); __pyx_t_42 = 0; __pyx_t_42 = __Pyx_PyObject_CallOneArg(__pyx_t_43, __pyx_t_40); if (unlikely(!__pyx_t_42)) __PYX_ERR(0, 111, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_42); __Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0; __Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0; __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_42); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 111, __pyx_L1_error) __Pyx_DECREF(__pyx_t_42); __pyx_t_42 = 0; if (__pyx_t_2) { /* … */ } /* … */ __pyx_tuple__112 = PyTuple_Pack(1, __pyx_kp_s_pysndlib); if (unlikely(!__pyx_tuple__112)) __PYX_ERR(0, 111, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__112); __Pyx_GIVEREF(__pyx_tuple__112);
+0112: exec(open(os.path.expanduser('~/.pysndlib')).read())
__Pyx_GetModuleGlobalName(__pyx_t_42, __pyx_n_s_os); if (unlikely(!__pyx_t_42)) __PYX_ERR(0, 112, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_42); __pyx_t_40 = __Pyx_PyObject_GetAttrStr(__pyx_t_42, __pyx_n_s_path); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 112, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_40); __Pyx_DECREF(__pyx_t_42); __pyx_t_42 = 0; __pyx_t_42 = __Pyx_PyObject_GetAttrStr(__pyx_t_40, __pyx_n_s_expanduser); if (unlikely(!__pyx_t_42)) __PYX_ERR(0, 112, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_42); __Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0; __pyx_t_40 = __Pyx_PyObject_Call(__pyx_t_42, __pyx_tuple__112, NULL); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 112, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_40); __Pyx_DECREF(__pyx_t_42); __pyx_t_42 = 0; __pyx_t_42 = __Pyx_PyObject_CallOneArg(__pyx_builtin_open, __pyx_t_40); if (unlikely(!__pyx_t_42)) __PYX_ERR(0, 112, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_42); __Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0; __pyx_t_40 = __Pyx_PyObject_GetAttrStr(__pyx_t_42, __pyx_n_s_read); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 112, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_40); __Pyx_DECREF(__pyx_t_42); __pyx_t_42 = 0; __pyx_t_42 = __Pyx_PyObject_CallNoArg(__pyx_t_40); if (unlikely(!__pyx_t_42)) __PYX_ERR(0, 112, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_42); __Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0; __pyx_t_40 = __Pyx_PyExecGlobals(__pyx_t_42); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 112, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_40); __Pyx_DECREF(__pyx_t_42); __pyx_t_42 = 0; __Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
0113:
0114: # --------------- initializations ---------------- #
0115:
+0116: cclm.mus_initialize()
mus_initialize();
+0117: cclm.mus_set_rand_seed(int(time.time()))
__Pyx_GetModuleGlobalName(__pyx_t_40, __pyx_n_s_time); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 117, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_40); __pyx_t_42 = __Pyx_PyObject_GetAttrStr(__pyx_t_40, __pyx_n_s_time); if (unlikely(!__pyx_t_42)) __PYX_ERR(0, 117, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_42); __Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0; __pyx_t_40 = __Pyx_PyObject_CallNoArg(__pyx_t_42); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 117, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_40); __Pyx_DECREF(__pyx_t_42); __pyx_t_42 = 0; __pyx_t_42 = __Pyx_PyNumber_Int(__pyx_t_40); if (unlikely(!__pyx_t_42)) __PYX_ERR(0, 117, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_42); __Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0; __pyx_t_45 = __Pyx_PyInt_As_uint64_t(__pyx_t_42); if (unlikely((__pyx_t_45 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 117, __pyx_L1_error) __Pyx_DECREF(__pyx_t_42); __pyx_t_42 = 0; mus_set_rand_seed(__pyx_t_45);
+0118: csndlib.mus_sound_initialize()
(void)(mus_sound_initialize());
0119:
+0120: cdef void clm_error_handler(int error_type, char* msg):
static void __pyx_f_8pysndlib_3clm_clm_error_handler(int __pyx_v_error_type, char *__pyx_v_msg) {
PyObject *__pyx_v_message = NULL;
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_AddTraceback("pysndlib.clm.clm_error_handler", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_XDECREF(__pyx_v_message);
__Pyx_RefNannyFinishContext();
}
+0121: message = msg + ". " + csndlib.mus_error_type_to_string(error_type)
__pyx_t_1 = __Pyx_PyUnicode_FromString(__pyx_v_msg); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 121, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyUnicode_ConcatInPlace(__pyx_t_1, __pyx_kp_s__13); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 121, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_PyUnicode_FromString(mus_error_type_to_string(__pyx_v_error_type)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 121, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = __Pyx_PyUnicode_ConcatInPlace(__pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 121, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_message = __pyx_t_3; __pyx_t_3 = 0;
+0122: raise SNDLibError(message)
__Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_SNDLibError); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 122, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = NULL; __pyx_t_4 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_1))) { __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_1); if (likely(__pyx_t_2)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); __Pyx_INCREF(__pyx_t_2); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_1, function); __pyx_t_4 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_v_message}; __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_1, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 122, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __PYX_ERR(0, 122, __pyx_L1_error)
0123:
+0124: class SNDLibError(Exception):
__pyx_t_42 = PyTuple_New(1); if (unlikely(!__pyx_t_42)) __PYX_ERR(0, 124, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_42); __Pyx_INCREF((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])); __Pyx_GIVEREF((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_42, 0, ((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])))) __PYX_ERR(0, 124, __pyx_L1_error); __pyx_t_40 = __Pyx_PEP560_update_bases(__pyx_t_42); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 124, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_40); __pyx_t_43 = __Pyx_CalculateMetaclass(NULL, __pyx_t_40); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 124, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_43); __pyx_t_37 = __Pyx_Py3MetaclassPrepare(__pyx_t_43, __pyx_t_40, __pyx_n_s_SNDLibError, __pyx_n_s_SNDLibError, (PyObject *) NULL, __pyx_n_s_pysndlib_clm, __pyx_kp_s_this_is_general_class_to_raise); if (unlikely(!__pyx_t_37)) __PYX_ERR(0, 124, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_37); if (__pyx_t_40 != __pyx_t_42) { if (unlikely((PyDict_SetItemString(__pyx_t_37, "__orig_bases__", __pyx_t_42) < 0))) __PYX_ERR(0, 124, __pyx_L1_error) } __Pyx_DECREF(__pyx_t_42); __pyx_t_42 = 0; __pyx_t_42 = PyList_New(0); if (unlikely(!__pyx_t_42)) __PYX_ERR(0, 124, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_42); /* … */ __pyx_t_41 = __Pyx_Py3ClassCreate(__pyx_t_43, __pyx_n_s_SNDLibError, __pyx_t_40, __pyx_t_37, NULL, 0, 0); if (unlikely(!__pyx_t_41)) __PYX_ERR(0, 124, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_41); if (__Pyx_CyFunction_InitClassCell(__pyx_t_42, __pyx_t_41) < 0) __PYX_ERR(0, 124, __pyx_L1_error) __Pyx_DECREF(__pyx_t_42); __pyx_t_42 = 0; if (PyDict_SetItem(__pyx_d, __pyx_n_s_SNDLibError, __pyx_t_41) < 0) __PYX_ERR(0, 124, __pyx_L1_error) __Pyx_DECREF(__pyx_t_41); __pyx_t_41 = 0; __Pyx_DECREF(__pyx_t_37); __pyx_t_37 = 0; __Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0; __Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
0125: """
0126: this is general class to raise an print errors as defined in sndlib. it is to be used internally by the defined error handler registered with sndlib
0127:
0128: :meta private:
0129: """
0130:
+0131: def ___init___(self, message):
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_11SNDLibError_1___init___(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_8pysndlib_3clm_11SNDLibError_1___init___ = {"___init___", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_11SNDLibError_1___init___, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_8pysndlib_3clm_11SNDLibError_1___init___(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
PyObject *__pyx_v_self = 0;
CYTHON_UNUSED PyObject *__pyx_v_message = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("___init___ (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_message,0};
PyObject* values[2] = {0,0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_self)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 131, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_message)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 131, __pyx_L3_error)
else {
__Pyx_RaiseArgtupleInvalid("___init___", 1, 2, 2, 1); __PYX_ERR(0, 131, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "___init___") < 0)) __PYX_ERR(0, 131, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 2)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
}
__pyx_v_self = values[0];
__pyx_v_message = values[1];
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("___init___", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 131, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.SNDLibError.___init___", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_8pysndlib_3clm_11SNDLibError____init___(__pyx_self, __pyx_v_self, __pyx_v_message);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_11SNDLibError____init___(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_message) {
PyObject *__pyx_r = NULL;
/* … */
/* function exit code */
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_AddTraceback("pysndlib.clm.SNDLibError.___init___", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_tuple__113 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_message); if (unlikely(!__pyx_tuple__113)) __PYX_ERR(0, 131, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__113);
__Pyx_GIVEREF(__pyx_tuple__113);
/* … */
__pyx_t_41 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_11SNDLibError_1___init___, 0, __pyx_n_s_SNDLibError____init, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__114)); if (unlikely(!__pyx_t_41)) __PYX_ERR(0, 131, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_41);
__Pyx_INCREF(__pyx_t_41);
PyList_Append(__pyx_t_42, __pyx_t_41);
__Pyx_GIVEREF(__pyx_t_41);
if (__Pyx_SetNameInClass(__pyx_t_37, __pyx_n_s_init_2, __pyx_t_41) < 0) __PYX_ERR(0, 131, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_41); __pyx_t_41 = 0;
__pyx_codeobj__114 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__113, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_init_2, 131, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__114)) __PYX_ERR(0, 131, __pyx_L1_error)
+0132: super().__init__(self.message)
__pyx_t_2 = __Pyx_CyFunction_GetClassObj(__pyx_self); if (!__pyx_t_2) { PyErr_SetString(PyExc_SystemError, "super(): empty __class__ cell"); __PYX_ERR(0, 132, __pyx_L1_error) } __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 132, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_GIVEREF(__pyx_t_2); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2)) __PYX_ERR(0, 132, __pyx_L1_error); __Pyx_INCREF(__pyx_v_self); __Pyx_GIVEREF(__pyx_v_self); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_self)) __PYX_ERR(0, 132, __pyx_L1_error); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_super, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 132, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_init); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 132, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_message); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 132, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_4 = NULL; __pyx_t_5 = 0; #if CYTHON_UNPACK_METHODS if (likely(PyMethod_Check(__pyx_t_3))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); __pyx_t_5 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_2}; __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 132, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
0133:
0134:
0135:
+0136: cpdef check_ndim(arr: npt.NDArray[np.float64], dim=1):
static PyObject *__pyx_pw_8pysndlib_3clm_1check_ndim(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyObject *__pyx_f_8pysndlib_3clm_check_ndim(PyObject *__pyx_v_arr, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_8pysndlib_3clm_check_ndim *__pyx_optional_args) {
PyObject *__pyx_v_dim = ((PyObject *)__pyx_int_1);
PyObject *__pyx_r = NULL;
if (__pyx_optional_args) {
if (__pyx_optional_args->__pyx_n > 0) {
__pyx_v_dim = __pyx_optional_args->dim;
}
}
/* … */
/* function exit code */
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_6);
__Pyx_AddTraceback("pysndlib.clm.check_ndim", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_1check_ndim(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_8pysndlib_3clm_1check_ndim = {"check_ndim", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_1check_ndim, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_8pysndlib_3clm_1check_ndim(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
PyObject *__pyx_v_arr = 0;
PyObject *__pyx_v_dim = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("check_ndim (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_arr,&__pyx_n_s_dim,0};
PyObject* values[2] = {0,0};
values[1] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)__pyx_int_1));
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_arr)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 136, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_dim);
if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 136, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "check_ndim") < 0)) __PYX_ERR(0, 136, __pyx_L3_error)
}
} else {
switch (__pyx_nargs) {
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
break;
default: goto __pyx_L5_argtuple_error;
}
}
__pyx_v_arr = values[0];
__pyx_v_dim = values[1];
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("check_ndim", 0, 1, 2, __pyx_nargs); __PYX_ERR(0, 136, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.check_ndim", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_8pysndlib_3clm_check_ndim(__pyx_self, __pyx_v_arr, __pyx_v_dim);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_check_ndim(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_arr, PyObject *__pyx_v_dim) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_2.__pyx_n = 1;
__pyx_t_2.dim = __pyx_v_dim;
__pyx_t_1 = __pyx_f_8pysndlib_3clm_check_ndim(__pyx_v_arr, 0, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 136, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("pysndlib.clm.check_ndim", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_tuple__115 = PyTuple_Pack(2, __pyx_n_s_arr, __pyx_n_s_dim); if (unlikely(!__pyx_tuple__115)) __PYX_ERR(0, 136, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__115);
__Pyx_GIVEREF(__pyx_tuple__115);
__pyx_codeobj__116 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__115, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_check_ndim, 136, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__116)) __PYX_ERR(0, 136, __pyx_L1_error)
/* … */
__pyx_t_40 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 136, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
if (PyDict_SetItem(__pyx_t_40, __pyx_n_s_arr, __pyx_kp_s_npt_NDArray_np_float64) < 0) __PYX_ERR(0, 136, __pyx_L1_error)
__pyx_t_43 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_1check_ndim, 0, __pyx_n_s_check_ndim, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__116)); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 136, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
__Pyx_CyFunction_SetDefaultsTuple(__pyx_t_43, __pyx_tuple__117);
__Pyx_CyFunction_SetAnnotationsDict(__pyx_t_43, __pyx_t_40);
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
if (PyDict_SetItem(__pyx_d, __pyx_n_s_check_ndim, __pyx_t_43) < 0) __PYX_ERR(0, 136, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
__pyx_tuple__117 = PyTuple_Pack(1, __pyx_int_1); if (unlikely(!__pyx_tuple__117)) __PYX_ERR(0, 136, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__117);
__Pyx_GIVEREF(__pyx_tuple__117);
/* … */
struct __pyx_opt_args_8pysndlib_3clm_check_ndim {
int __pyx_n;
PyObject *dim;
};
+0137: if arr.ndim != dim:
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_arr, __pyx_n_s_ndim); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 137, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_v_dim, Py_NE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 137, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 137, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (unlikely(__pyx_t_3)) { /* … */ }
+0138: raise TypeError(f'expecting {dim} dimemsions but received {arr.ndim}.')
__pyx_t_2 = PyTuple_New(5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 138, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_4 = 0; __pyx_t_5 = 127; __Pyx_INCREF(__pyx_kp_u_expecting); __pyx_t_4 += 10; __Pyx_GIVEREF(__pyx_kp_u_expecting); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_kp_u_expecting); __pyx_t_1 = __Pyx_PyObject_FormatSimple(__pyx_v_dim, __pyx_empty_unicode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 138, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_5 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_1) > __pyx_t_5) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_1) : __pyx_t_5; __pyx_t_4 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1); __pyx_t_1 = 0; __Pyx_INCREF(__pyx_kp_u_dimemsions_but_received); __pyx_t_4 += 25; __Pyx_GIVEREF(__pyx_kp_u_dimemsions_but_received); PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_kp_u_dimemsions_but_received); __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_arr, __pyx_n_s_ndim); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 138, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_6 = __Pyx_PyObject_FormatSimple(__pyx_t_1, __pyx_empty_unicode); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 138, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_5 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) > __pyx_t_5) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) : __pyx_t_5; __pyx_t_4 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_6); __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_t_6); __pyx_t_6 = 0; __Pyx_INCREF(__pyx_kp_u__3); __pyx_t_4 += 1; __Pyx_GIVEREF(__pyx_kp_u__3); PyTuple_SET_ITEM(__pyx_t_2, 4, __pyx_kp_u__3); __pyx_t_6 = __Pyx_PyUnicode_Join(__pyx_t_2, 5, __pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 138, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 138, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __PYX_ERR(0, 138, __pyx_L1_error)
0139:
+0140: cpdef check_range(arg: str, x, low=None, high=None):
static PyObject *__pyx_pw_8pysndlib_3clm_3check_range(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyObject *__pyx_f_8pysndlib_3clm_check_range(PyObject *__pyx_v_arg, PyObject *__pyx_v_x, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_8pysndlib_3clm_check_range *__pyx_optional_args) {
PyObject *__pyx_v_low = ((PyObject *)Py_None);
PyObject *__pyx_v_high = ((PyObject *)Py_None);
PyObject *__pyx_r = NULL;
if (__pyx_optional_args) {
if (__pyx_optional_args->__pyx_n > 0) {
__pyx_v_low = __pyx_optional_args->low;
if (__pyx_optional_args->__pyx_n > 1) {
__pyx_v_high = __pyx_optional_args->high;
}
}
}
/* … */
/* function exit code */
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_5);
__Pyx_AddTraceback("pysndlib.clm.check_range", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_3check_range(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_8pysndlib_3clm_3check_range = {"check_range", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_3check_range, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_8pysndlib_3clm_3check_range(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
PyObject *__pyx_v_arg = 0;
PyObject *__pyx_v_x = 0;
PyObject *__pyx_v_low = 0;
PyObject *__pyx_v_high = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("check_range (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_arg,&__pyx_n_s_x,&__pyx_n_s_low,&__pyx_n_s_high,0};
PyObject* values[4] = {0,0,0,0};
values[2] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
values[3] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
CYTHON_FALLTHROUGH;
case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_arg)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 140, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_x)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 140, __pyx_L3_error)
else {
__Pyx_RaiseArgtupleInvalid("check_range", 0, 2, 4, 1); __PYX_ERR(0, 140, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 2:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_low);
if (value) { values[2] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 140, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 3:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_high);
if (value) { values[3] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 140, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "check_range") < 0)) __PYX_ERR(0, 140, __pyx_L3_error)
}
} else {
switch (__pyx_nargs) {
case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
CYTHON_FALLTHROUGH;
case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
break;
default: goto __pyx_L5_argtuple_error;
}
}
__pyx_v_arg = ((PyObject*)values[0]);
__pyx_v_x = values[1];
__pyx_v_low = values[2];
__pyx_v_high = values[3];
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("check_range", 0, 2, 4, __pyx_nargs); __PYX_ERR(0, 140, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.check_range", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_arg), (&PyString_Type), 0, "arg", 1))) __PYX_ERR(0, 140, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_2check_range(__pyx_self, __pyx_v_arg, __pyx_v_x, __pyx_v_low, __pyx_v_high);
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_2check_range(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_arg, PyObject *__pyx_v_x, PyObject *__pyx_v_low, PyObject *__pyx_v_high) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_2.__pyx_n = 2;
__pyx_t_2.low = __pyx_v_low;
__pyx_t_2.high = __pyx_v_high;
__pyx_t_1 = __pyx_f_8pysndlib_3clm_check_range(__pyx_v_arg, __pyx_v_x, 0, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 140, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("pysndlib.clm.check_range", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_tuple__118 = PyTuple_Pack(4, __pyx_n_s_arg, __pyx_n_s_x, __pyx_n_s_low, __pyx_n_s_high); if (unlikely(!__pyx_tuple__118)) __PYX_ERR(0, 140, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__118);
__Pyx_GIVEREF(__pyx_tuple__118);
__pyx_codeobj__119 = (PyObject*)__Pyx_PyCode_New(4, 0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__118, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_check_range, 140, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__119)) __PYX_ERR(0, 140, __pyx_L1_error)
/* … */
__pyx_t_43 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 140, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
if (PyDict_SetItem(__pyx_t_43, __pyx_n_s_arg, __pyx_n_s_str_2) < 0) __PYX_ERR(0, 140, __pyx_L1_error)
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_3check_range, 0, __pyx_n_s_check_range, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__119)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 140, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
__Pyx_CyFunction_SetDefaultsTuple(__pyx_t_40, __pyx_tuple__120);
__Pyx_CyFunction_SetAnnotationsDict(__pyx_t_40, __pyx_t_43);
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
if (PyDict_SetItem(__pyx_d, __pyx_n_s_check_range, __pyx_t_40) < 0) __PYX_ERR(0, 140, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
__pyx_tuple__120 = PyTuple_Pack(2, Py_None, Py_None); if (unlikely(!__pyx_tuple__120)) __PYX_ERR(0, 140, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__120);
__Pyx_GIVEREF(__pyx_tuple__120);
/* … */
struct __pyx_opt_args_8pysndlib_3clm_check_range {
int __pyx_n;
PyObject *low;
PyObject *high;
};
+0141: if x is None:
__pyx_t_1 = (__pyx_v_x == Py_None);
if (__pyx_t_1) {
/* … */
}
+0142: return
__Pyx_XDECREF(__pyx_r); __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0;
+0143: if low is not None:
__pyx_t_1 = (__pyx_v_low != Py_None);
if (__pyx_t_1) {
/* … */
}
+0144: if x < low:
__pyx_t_2 = PyObject_RichCompare(__pyx_v_x, __pyx_v_low, Py_LT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 144, __pyx_L1_error) __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 144, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (unlikely(__pyx_t_1)) { /* … */ }
+0145: raise ValueError(f'{arg} is out of range. {x} < {low}')
__pyx_t_2 = PyTuple_New(5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 145, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = 0; __pyx_t_4 = 127; __pyx_t_5 = __Pyx_PyObject_FormatSimple(__pyx_v_arg, __pyx_empty_unicode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 145, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_4 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) > __pyx_t_4) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) : __pyx_t_4; __pyx_t_3 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_5); __pyx_t_5 = 0; __Pyx_INCREF(__pyx_kp_u_is_out_of_range); __pyx_t_3 += 18; __Pyx_GIVEREF(__pyx_kp_u_is_out_of_range); PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_kp_u_is_out_of_range); __pyx_t_5 = __Pyx_PyObject_FormatSimple(__pyx_v_x, __pyx_empty_unicode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 145, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_4 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) > __pyx_t_4) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) : __pyx_t_4; __pyx_t_3 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_5); __pyx_t_5 = 0; __Pyx_INCREF(__pyx_kp_u__14); __pyx_t_3 += 3; __Pyx_GIVEREF(__pyx_kp_u__14); PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_kp_u__14); __pyx_t_5 = __Pyx_PyObject_FormatSimple(__pyx_v_low, __pyx_empty_unicode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 145, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_4 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) > __pyx_t_4) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) : __pyx_t_4; __pyx_t_3 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_2, 4, __pyx_t_5); __pyx_t_5 = 0; __pyx_t_5 = __Pyx_PyUnicode_Join(__pyx_t_2, 5, __pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 145, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 145, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __PYX_ERR(0, 145, __pyx_L1_error)
+0146: if high is not None:
__pyx_t_1 = (__pyx_v_high != Py_None);
if (__pyx_t_1) {
/* … */
}
+0147: if x > high:
__pyx_t_2 = PyObject_RichCompare(__pyx_v_x, __pyx_v_high, Py_GT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 147, __pyx_L1_error) __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 147, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (unlikely(__pyx_t_1)) { /* … */ }
+0148: raise ValueError(f'{arg} is out of range. {x} > {high}')
__pyx_t_2 = PyTuple_New(5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 148, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = 0; __pyx_t_4 = 127; __pyx_t_5 = __Pyx_PyObject_FormatSimple(__pyx_v_arg, __pyx_empty_unicode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 148, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_4 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) > __pyx_t_4) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) : __pyx_t_4; __pyx_t_3 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_5); __pyx_t_5 = 0; __Pyx_INCREF(__pyx_kp_u_is_out_of_range); __pyx_t_3 += 18; __Pyx_GIVEREF(__pyx_kp_u_is_out_of_range); PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_kp_u_is_out_of_range); __pyx_t_5 = __Pyx_PyObject_FormatSimple(__pyx_v_x, __pyx_empty_unicode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 148, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_4 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) > __pyx_t_4) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) : __pyx_t_4; __pyx_t_3 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_5); __pyx_t_5 = 0; __Pyx_INCREF(__pyx_kp_u__15); __pyx_t_3 += 3; __Pyx_GIVEREF(__pyx_kp_u__15); PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_kp_u__15); __pyx_t_5 = __Pyx_PyObject_FormatSimple(__pyx_v_high, __pyx_empty_unicode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 148, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_4 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) > __pyx_t_4) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) : __pyx_t_4; __pyx_t_3 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_2, 4, __pyx_t_5); __pyx_t_5 = 0; __pyx_t_5 = __Pyx_PyUnicode_Join(__pyx_t_2, 5, __pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 148, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 148, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __PYX_ERR(0, 148, __pyx_L1_error)
0149:
0150:
+0151: cpdef compare_shapes(arr1: npt.NDArray[np.float64], arr2: npt.NDArray[np.float64]):
static PyObject *__pyx_pw_8pysndlib_3clm_5compare_shapes(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyObject *__pyx_f_8pysndlib_3clm_compare_shapes(PyObject *__pyx_v_arr1, PyObject *__pyx_v_arr2, CYTHON_UNUSED int __pyx_skip_dispatch) {
PyObject *__pyx_r = NULL;
/* … */
/* function exit code */
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_AddTraceback("pysndlib.clm.compare_shapes", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_5compare_shapes(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_8pysndlib_3clm_5compare_shapes = {"compare_shapes", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_5compare_shapes, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_8pysndlib_3clm_5compare_shapes(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
PyObject *__pyx_v_arr1 = 0;
PyObject *__pyx_v_arr2 = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("compare_shapes (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_arr1,&__pyx_n_s_arr2,0};
PyObject* values[2] = {0,0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_arr1)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 151, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_arr2)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 151, __pyx_L3_error)
else {
__Pyx_RaiseArgtupleInvalid("compare_shapes", 1, 2, 2, 1); __PYX_ERR(0, 151, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "compare_shapes") < 0)) __PYX_ERR(0, 151, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 2)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
}
__pyx_v_arr1 = values[0];
__pyx_v_arr2 = values[1];
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("compare_shapes", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 151, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.compare_shapes", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_8pysndlib_3clm_4compare_shapes(__pyx_self, __pyx_v_arr1, __pyx_v_arr2);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_4compare_shapes(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_arr1, PyObject *__pyx_v_arr2) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8pysndlib_3clm_compare_shapes(__pyx_v_arr1, __pyx_v_arr2, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 151, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("pysndlib.clm.compare_shapes", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_tuple__121 = PyTuple_Pack(2, __pyx_n_s_arr1, __pyx_n_s_arr2); if (unlikely(!__pyx_tuple__121)) __PYX_ERR(0, 151, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__121);
__Pyx_GIVEREF(__pyx_tuple__121);
/* … */
__pyx_t_40 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 151, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
if (PyDict_SetItem(__pyx_t_40, __pyx_n_s_arr1, __pyx_kp_s_npt_NDArray_np_float64) < 0) __PYX_ERR(0, 151, __pyx_L1_error)
if (PyDict_SetItem(__pyx_t_40, __pyx_n_s_arr2, __pyx_kp_s_npt_NDArray_np_float64) < 0) __PYX_ERR(0, 151, __pyx_L1_error)
__pyx_t_43 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_5compare_shapes, 0, __pyx_n_s_compare_shapes, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__122)); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 151, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
__Pyx_CyFunction_SetAnnotationsDict(__pyx_t_43, __pyx_t_40);
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
if (PyDict_SetItem(__pyx_d, __pyx_n_s_compare_shapes, __pyx_t_43) < 0) __PYX_ERR(0, 151, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
__pyx_codeobj__122 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__121, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_compare_shapes, 151, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__122)) __PYX_ERR(0, 151, __pyx_L1_error)
+0152: if arr1.shape != arr2.shape:
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_arr1, __pyx_n_s_shape); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 152, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_arr2, __pyx_n_s_shape); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 152, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, __pyx_t_2, Py_NE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 152, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 152, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(__pyx_t_4)) { /* … */ }
+0153: raise RuntimeError(f'ndarrays of unequal shape {arr1.shape } vs. {arr2.shape }.')
__pyx_t_3 = PyTuple_New(5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 153, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = 0; __pyx_t_6 = 127; __Pyx_INCREF(__pyx_kp_u_ndarrays_of_unequal_shape); __pyx_t_5 += 26; __Pyx_GIVEREF(__pyx_kp_u_ndarrays_of_unequal_shape); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_kp_u_ndarrays_of_unequal_shape); __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_arr1, __pyx_n_s_shape); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 153, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_1 = __Pyx_PyObject_FormatSimple(__pyx_t_2, __pyx_empty_unicode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 153, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_6 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_1) > __pyx_t_6) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_1) : __pyx_t_6; __pyx_t_5 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1); __pyx_t_1 = 0; __Pyx_INCREF(__pyx_kp_u_vs); __pyx_t_5 += 5; __Pyx_GIVEREF(__pyx_kp_u_vs); PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_kp_u_vs); __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_arr2, __pyx_n_s_shape); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 153, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyObject_FormatSimple(__pyx_t_1, __pyx_empty_unicode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 153, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_6 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_2) > __pyx_t_6) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_2) : __pyx_t_6; __pyx_t_5 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_3, 3, __pyx_t_2); __pyx_t_2 = 0; __Pyx_INCREF(__pyx_kp_u__3); __pyx_t_5 += 1; __Pyx_GIVEREF(__pyx_kp_u__3); PyTuple_SET_ITEM(__pyx_t_3, 4, __pyx_kp_u__3); __pyx_t_2 = __Pyx_PyUnicode_Join(__pyx_t_3, 5, __pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 153, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_RuntimeError, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 153, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __PYX_ERR(0, 153, __pyx_L1_error)
0154:
+0155: csndlib.mus_error_set_handler(<csndlib.mus_error_handler_t *>clm_error_handler)
(void)(mus_error_set_handler(((mus_error_handler_t *)__pyx_f_8pysndlib_3clm_clm_error_handler)));
0156:
0157:
+0158: cdef bint is_simple_filter(gen: mus_any):
static int __pyx_f_8pysndlib_3clm_is_simple_filter(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen) {
int __pyx_r;
/* … */
/* function exit code */
__pyx_L0:;
return __pyx_r;
}
+0159: return cclm.mus_is_one_zero(gen._ptr) or cclm.mus_is_one_pole(gen._ptr) or cclm.mus_is_two_zero(gen._ptr) or cclm.mus_is_two_pole(gen._ptr)
__pyx_t_2 = mus_is_one_zero(__pyx_v_gen->_ptr);
if (!__pyx_t_2) {
} else {
__pyx_t_1 = __pyx_t_2;
goto __pyx_L3_bool_binop_done;
}
__pyx_t_2 = mus_is_one_pole(__pyx_v_gen->_ptr);
if (!__pyx_t_2) {
} else {
__pyx_t_1 = __pyx_t_2;
goto __pyx_L3_bool_binop_done;
}
__pyx_t_2 = mus_is_two_zero(__pyx_v_gen->_ptr);
if (!__pyx_t_2) {
} else {
__pyx_t_1 = __pyx_t_2;
goto __pyx_L3_bool_binop_done;
}
__pyx_t_2 = mus_is_two_pole(__pyx_v_gen->_ptr);
__pyx_t_1 = __pyx_t_2;
__pyx_L3_bool_binop_done:;
__pyx_r = __pyx_t_1;
goto __pyx_L0;
0160:
0161:
0162: # cdef bint is_poly(gen: mus_any):
0163: # return cclm.mus_is_polywave(gen._ptr) or cclm.mus_is_polyshape(gen._ptr)
0164:
0165: # todo add mus_set_xcoeff and mus_set_ycoeff
0166:
0167: # --------------- extension types ---------------- #
0168:
+0169: cdef class mus_any:
struct __pyx_vtabstruct_8pysndlib_3clm_mus_any {
struct __pyx_obj_8pysndlib_3clm_mus_any *(*from_ptr)(mus_any *, struct __pyx_opt_args_8pysndlib_3clm_7mus_any_from_ptr *__pyx_optional_args);
PyObject *(*cache_append)(struct __pyx_obj_8pysndlib_3clm_mus_any *, PyObject *, int __pyx_skip_dispatch);
PyObject *(*cache_extend)(struct __pyx_obj_8pysndlib_3clm_mus_any *, PyObject *, int __pyx_skip_dispatch);
PyObject *(*set_up_data)(struct __pyx_obj_8pysndlib_3clm_mus_any *, int __pyx_skip_dispatch, struct __pyx_opt_args_8pysndlib_3clm_7mus_any_set_up_data *__pyx_optional_args);
PyObject *(*set_up_xcoeffs)(struct __pyx_obj_8pysndlib_3clm_mus_any *, int __pyx_skip_dispatch);
PyObject *(*set_up_ycoeffs)(struct __pyx_obj_8pysndlib_3clm_mus_any *, int __pyx_skip_dispatch);
PyObject *(*set_up_pv_data)(struct __pyx_obj_8pysndlib_3clm_mus_any *, int __pyx_skip_dispatch);
};
static struct __pyx_vtabstruct_8pysndlib_3clm_mus_any *__pyx_vtabptr_8pysndlib_3clm_mus_any;
0170: """
0171: a wrapper class for mus_any pointers in c
0172:
0173: instances of this class have the following properties, which may be
0174: used if supported by the type of generator used to make the instance:
0175:
0176:
0177: """
0178: # in pxd definition
0179: # cdef cclm.mus_any *_ptr
0180: # cdef bint ptr_owner
0181: # cdef cclm.input_cb _inputcallback
0182: # cdef cclm.edit_cb _editcallback
0183: # cdef cclm.analyze_cb _analyzecallback
0184: # cdef cclm.synthesize_cb _synthesizecallback
0185: # cdef list _cache
0186: # cdef cclm.mus_float_t* _data_ptr
0187: # cdef np.ndarray _data
0188: # cdef cclm.mus_float_t* _xcoeffs_ptr
0189: # cdef np.ndarray _xcoeffs
0190: # cdef cclm.mus_float_t* _ycoeffs_ptr
0191: # cdef np.ndarray _ycoeffs
0192: # cdef cclm.mus_float_t* _pv_amp_increments_ptr
0193: # cdef np.ndarray _pv_amp_increments
0194: # cdef cclm.mus_float_t* _pv_amps_ptr
0195: # cdef np.ndarray _pv_amps
0196: # cdef cclm.mus_float_t* _pv_freqs_ptr
0197: # cdef np.ndarray _pv_freqs
0198: # cdef cclm.mus_float_t* _pv_phases_ptr
0199: # cdef np.ndarray _pv_phases
0200: # cdef cclm.mus_float_t* _pv_phase_increments_ptr
0201: # cdef np.ndarray _pv_phase_increments
0202: #
+0203: def __cinit__(self):
/* Python wrapper */
static int __pyx_pw_8pysndlib_3clm_7mus_any_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_8pysndlib_3clm_7mus_any_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
int __pyx_r;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
#endif
__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
if (unlikely(__pyx_nargs > 0)) {
__Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, __pyx_nargs); return -1;}
if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_VARARGS(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 0))) return -1;
__pyx_r = __pyx_pf_8pysndlib_3clm_7mus_any___cinit__(((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static int __pyx_pf_8pysndlib_3clm_7mus_any___cinit__(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_self) {
int __pyx_r;
/* … */
/* function exit code */
__pyx_r = 0;
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("pysndlib.clm.mus_any.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = -1;
__pyx_L0:;
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
+0204: self.ptr_owner = False
__pyx_v_self->ptr_owner = 0;
+0205: self._cache = []
__pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 205, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __Pyx_GOTREF(__pyx_v_self->_cache); __Pyx_DECREF(__pyx_v_self->_cache); __pyx_v_self->_cache = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0;
+0206: self._inputcallback = NULL
__pyx_v_self->_inputcallback = NULL;
+0207: self._editcallback = NULL
__pyx_v_self->_editcallback = NULL;
+0208: self._analyzecallback = NULL
__pyx_v_self->_analyzecallback = NULL;
+0209: self._synthesizecallback = NULL
__pyx_v_self->_synthesizecallback = NULL;
+0210: self._cache = []
__pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 210, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __Pyx_GOTREF(__pyx_v_self->_cache); __Pyx_DECREF(__pyx_v_self->_cache); __pyx_v_self->_cache = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0;
0211:
0212:
+0213: def __delalloc__(self):
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_7mus_any_3__delalloc__(PyObject *__pyx_v_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_8pysndlib_3clm_7mus_any_3__delalloc__ = {"__delalloc__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_7mus_any_3__delalloc__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_8pysndlib_3clm_7mus_any_3__delalloc__(PyObject *__pyx_v_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__delalloc__ (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
if (unlikely(__pyx_nargs > 0)) {
__Pyx_RaiseArgtupleInvalid("__delalloc__", 1, 0, 0, __pyx_nargs); return NULL;}
if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__delalloc__", 0))) return NULL;
__pyx_r = __pyx_pf_8pysndlib_3clm_7mus_any_2__delalloc__(((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_7mus_any_2__delalloc__(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_self) {
PyObject *__pyx_r = NULL;
/* … */
/* function exit code */
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_43 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_7mus_any_3__delalloc__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_mus_any___delalloc, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__123)); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 213, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_8pysndlib_3clm_mus_any, __pyx_n_s_delalloc, __pyx_t_43) < 0) __PYX_ERR(0, 213, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
PyType_Modified(__pyx_ptype_8pysndlib_3clm_mus_any);
/* … */
__pyx_codeobj__123 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__91, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_delalloc, 213, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__123)) __PYX_ERR(0, 213, __pyx_L1_error)
+0214: if self._ptr is not NULL and self.ptr_owner is True:
__pyx_t_2 = (__pyx_v_self->_ptr != NULL);
if (__pyx_t_2) {
} else {
__pyx_t_1 = __pyx_t_2;
goto __pyx_L4_bool_binop_done;
}
__pyx_t_2 = (__pyx_v_self->ptr_owner == 1);
__pyx_t_1 = __pyx_t_2;
__pyx_L4_bool_binop_done:;
if (__pyx_t_1) {
/* … */
}
+0215: cclm.mus_free(self._ptr)
mus_free(__pyx_v_self->_ptr);
+0216: self._ptr = NULL
__pyx_v_self->_ptr = NULL;
0217:
0218:
+0219: def __init__(self):
/* Python wrapper */
static int __pyx_pw_8pysndlib_3clm_7mus_any_5__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_8pysndlib_3clm_7mus_any_5__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
int __pyx_r;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
#endif
__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
if (unlikely(__pyx_nargs > 0)) {
__Pyx_RaiseArgtupleInvalid("__init__", 1, 0, 0, __pyx_nargs); return -1;}
if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_VARARGS(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__init__", 0))) return -1;
__pyx_r = __pyx_pf_8pysndlib_3clm_7mus_any_4__init__(((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static int __pyx_pf_8pysndlib_3clm_7mus_any_4__init__(CYTHON_UNUSED struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_self) {
int __pyx_r;
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("pysndlib.clm.mus_any.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = -1;
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
0220: # prevent accidental instantiation from normal python code
0221: # since we cannot pass a struct pointer into a python constructor.
+0222: raise TypeError("this class cannot be instantiated directly.")
__pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__16, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 222, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __PYX_ERR(0, 222, __pyx_L1_error) /* … */ __pyx_tuple__16 = PyTuple_Pack(1, __pyx_kp_s_this_class_cannot_be_instantiate); if (unlikely(!__pyx_tuple__16)) __PYX_ERR(0, 222, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__16); __Pyx_GIVEREF(__pyx_tuple__16);
0223:
0224: @staticmethod
+0225: cdef mus_any from_ptr(cclm.mus_any *_ptr, bint owner=True, int length=0): #adding brkpoints as want to know number of brkpoints in envelope. kind of hacky
static struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_f_8pysndlib_3clm_7mus_any_from_ptr(mus_any *__pyx_v__ptr, struct __pyx_opt_args_8pysndlib_3clm_7mus_any_from_ptr *__pyx_optional_args) {
int __pyx_v_owner = ((int)1);
int __pyx_v_length = ((int)0);
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_wrapper = 0;
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_r = NULL;
if (__pyx_optional_args) {
if (__pyx_optional_args->__pyx_n > 0) {
__pyx_v_owner = __pyx_optional_args->owner;
if (__pyx_optional_args->__pyx_n > 1) {
__pyx_v_length = __pyx_optional_args->length;
}
}
}
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("pysndlib.clm.mus_any.from_ptr", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XDECREF((PyObject *)__pyx_v_wrapper);
__Pyx_XGIVEREF((PyObject *)__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
0226: """
0227: factory function to create mus_any objects from
0228: given mus_any pointer.
0229:
0230: setting ``owner`` flag to ``True`` causes
0231: the extension type to ``free`` the structure pointed to by ``_ptr``
0232: when the wrapper object is deallocated.
0233:
0234: :meta private:
0235: """
0236: # fast call to __new__() that bypasses the __init__() constructor.
+0237: cdef mus_any wrapper = mus_any.__new__(mus_any)
__pyx_t_1 = ((PyObject *)__pyx_tp_new_8pysndlib_3clm_mus_any(((PyTypeObject *)__pyx_ptype_8pysndlib_3clm_mus_any), __pyx_empty_tuple, NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 237, __pyx_L1_error) __Pyx_GOTREF((PyObject *)__pyx_t_1); __pyx_v_wrapper = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_t_1); __pyx_t_1 = 0;
+0238: wrapper._ptr = _ptr
__pyx_v_wrapper->_ptr = __pyx_v__ptr;
+0239: wrapper.ptr_owner = owner
__pyx_v_wrapper->ptr_owner = __pyx_v_owner;
+0240: if cclm.mus_data_exists(wrapper._ptr):
__pyx_t_2 = mus_data_exists(__pyx_v_wrapper->_ptr);
if (__pyx_t_2) {
/* … */
}
+0241: wrapper.set_up_data(length=length)
__pyx_t_3.__pyx_n = 1;
__pyx_t_3.length = __pyx_v_length;
__pyx_t_1 = ((struct __pyx_vtabstruct_8pysndlib_3clm_mus_any *)__pyx_v_wrapper->__pyx_vtab)->set_up_data(__pyx_v_wrapper, 0, &__pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 241, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+0242: if cclm.mus_xcoeffs_exists(wrapper._ptr):
__pyx_t_2 = mus_xcoeffs_exists(__pyx_v_wrapper->_ptr);
if (__pyx_t_2) {
/* … */
}
0243: # do not setup this for polywave or polyshape
+0244: if not (cclm.mus_is_polywave(wrapper._ptr) or cclm.mus_is_polyshape(wrapper._ptr)):
__pyx_t_4 = mus_is_polywave(__pyx_v_wrapper->_ptr);
if (!__pyx_t_4) {
} else {
__pyx_t_2 = __pyx_t_4;
goto __pyx_L6_bool_binop_done;
}
__pyx_t_4 = mus_is_polyshape(__pyx_v_wrapper->_ptr);
__pyx_t_2 = __pyx_t_4;
__pyx_L6_bool_binop_done:;
__pyx_t_4 = (!__pyx_t_2);
if (__pyx_t_4) {
/* … */
}
+0245: wrapper.set_up_xcoeffs()
__pyx_t_1 = ((struct __pyx_vtabstruct_8pysndlib_3clm_mus_any *)__pyx_v_wrapper->__pyx_vtab)->set_up_xcoeffs(__pyx_v_wrapper, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 245, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+0246: if cclm.mus_ycoeffs_exists(wrapper._ptr):
__pyx_t_4 = mus_ycoeffs_exists(__pyx_v_wrapper->_ptr);
if (__pyx_t_4) {
/* … */
}
0247: # do not setup this for polywave or polyshape
+0248: if not (cclm.mus_is_polywave(wrapper._ptr) or cclm.mus_is_polyshape(wrapper._ptr)):
__pyx_t_2 = mus_is_polywave(__pyx_v_wrapper->_ptr);
if (!__pyx_t_2) {
} else {
__pyx_t_4 = __pyx_t_2;
goto __pyx_L10_bool_binop_done;
}
__pyx_t_2 = mus_is_polyshape(__pyx_v_wrapper->_ptr);
__pyx_t_4 = __pyx_t_2;
__pyx_L10_bool_binop_done:;
__pyx_t_2 = (!__pyx_t_4);
if (__pyx_t_2) {
/* … */
}
+0249: wrapper.set_up_ycoeffs()
__pyx_t_1 = ((struct __pyx_vtabstruct_8pysndlib_3clm_mus_any *)__pyx_v_wrapper->__pyx_vtab)->set_up_ycoeffs(__pyx_v_wrapper, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 249, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+0250: if is_phase_vocoder(wrapper):
__pyx_t_2 = __pyx_f_8pysndlib_3clm_is_phase_vocoder(__pyx_v_wrapper, 0); if (unlikely(__pyx_t_2 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 250, __pyx_L1_error) if (__pyx_t_2) { /* … */ }
+0251: wrapper.set_up_pv_data()
__pyx_t_1 = ((struct __pyx_vtabstruct_8pysndlib_3clm_mus_any *)__pyx_v_wrapper->__pyx_vtab)->set_up_pv_data(__pyx_v_wrapper, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 251, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
0252:
+0253: return wrapper
__Pyx_XDECREF((PyObject *)__pyx_r); __Pyx_INCREF((PyObject *)__pyx_v_wrapper); __pyx_r = __pyx_v_wrapper; goto __pyx_L0;
0254:
+0255: cpdef cache_append(self, obj):
static PyObject *__pyx_pw_8pysndlib_3clm_7mus_any_7cache_append(PyObject *__pyx_v_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyObject *__pyx_f_8pysndlib_3clm_7mus_any_cache_append(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_self, PyObject *__pyx_v_obj, int __pyx_skip_dispatch) {
PyObject *__pyx_r = NULL;
/* Check if called by wrapper */
if (unlikely(__pyx_skip_dispatch)) ;
/* Check if overridden in Python */
else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || __Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
PY_UINT64_T __pyx_typedict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
#endif
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_cache_append); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 255, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
if (!__Pyx_IsSameCFunction(__pyx_t_1, (void*) __pyx_pw_8pysndlib_3clm_7mus_any_7cache_append)) {
__Pyx_XDECREF(__pyx_r);
__Pyx_INCREF(__pyx_t_1);
__pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
__pyx_t_5 = 0;
#if CYTHON_UNPACK_METHODS
if (unlikely(PyMethod_Check(__pyx_t_3))) {
__pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
if (likely(__pyx_t_4)) {
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
__Pyx_INCREF(__pyx_t_4);
__Pyx_INCREF(function);
__Pyx_DECREF_SET(__pyx_t_3, function);
__pyx_t_5 = 1;
}
}
#endif
{
PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v_obj};
__pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5);
__Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 255, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
}
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
goto __pyx_L0;
}
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
__pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
__pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
if (unlikely(__pyx_typedict_guard != __pyx_tp_dict_version)) {
__pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
}
#endif
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
}
#endif
}
/* … */
/* function exit code */
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_AddTraceback("pysndlib.clm.mus_any.cache_append", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_7mus_any_7cache_append(PyObject *__pyx_v_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_7mus_any_6cache_append, "\n :meta private:\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_7mus_any_7cache_append = {"cache_append", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_7mus_any_7cache_append, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_7mus_any_6cache_append};
static PyObject *__pyx_pw_8pysndlib_3clm_7mus_any_7cache_append(PyObject *__pyx_v_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
PyObject *__pyx_v_obj = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("cache_append (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_obj,0};
PyObject* values[1] = {0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_obj)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 255, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "cache_append") < 0)) __PYX_ERR(0, 255, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 1)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
}
__pyx_v_obj = values[0];
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("cache_append", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 255, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.mus_any.cache_append", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_8pysndlib_3clm_7mus_any_6cache_append(((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_v_self), __pyx_v_obj);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_7mus_any_6cache_append(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_self, PyObject *__pyx_v_obj) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8pysndlib_3clm_7mus_any_cache_append(__pyx_v_self, __pyx_v_obj, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 255, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("pysndlib.clm.mus_any.cache_append", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_tuple__124 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_obj); if (unlikely(!__pyx_tuple__124)) __PYX_ERR(0, 255, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__124);
__Pyx_GIVEREF(__pyx_tuple__124);
/* … */
__pyx_t_43 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_7mus_any_7cache_append, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_mus_any_cache_append, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__125)); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 255, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_8pysndlib_3clm_mus_any, __pyx_n_s_cache_append, __pyx_t_43) < 0) __PYX_ERR(0, 255, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
PyType_Modified(__pyx_ptype_8pysndlib_3clm_mus_any);
__pyx_codeobj__125 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__124, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_cache_append, 255, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__125)) __PYX_ERR(0, 255, __pyx_L1_error)
0256: """
0257: :meta private:
0258: """
+0259: self._cache.append(obj)
if (unlikely(__pyx_v_self->_cache == Py_None)) {
PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "append");
__PYX_ERR(0, 259, __pyx_L1_error)
}
__pyx_t_6 = __Pyx_PyList_Append(__pyx_v_self->_cache, __pyx_v_obj); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(0, 259, __pyx_L1_error)
0260:
+0261: cpdef cache_extend(self, obj):
static PyObject *__pyx_pw_8pysndlib_3clm_7mus_any_9cache_extend(PyObject *__pyx_v_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyObject *__pyx_f_8pysndlib_3clm_7mus_any_cache_extend(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_self, PyObject *__pyx_v_obj, int __pyx_skip_dispatch) {
PyObject *__pyx_r = NULL;
/* Check if called by wrapper */
if (unlikely(__pyx_skip_dispatch)) ;
/* Check if overridden in Python */
else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || __Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
PY_UINT64_T __pyx_typedict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
#endif
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_cache_extend); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 261, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
if (!__Pyx_IsSameCFunction(__pyx_t_1, (void*) __pyx_pw_8pysndlib_3clm_7mus_any_9cache_extend)) {
__Pyx_XDECREF(__pyx_r);
__Pyx_INCREF(__pyx_t_1);
__pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
__pyx_t_5 = 0;
#if CYTHON_UNPACK_METHODS
if (unlikely(PyMethod_Check(__pyx_t_3))) {
__pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
if (likely(__pyx_t_4)) {
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
__Pyx_INCREF(__pyx_t_4);
__Pyx_INCREF(function);
__Pyx_DECREF_SET(__pyx_t_3, function);
__pyx_t_5 = 1;
}
}
#endif
{
PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v_obj};
__pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5);
__Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 261, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
}
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
goto __pyx_L0;
}
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
__pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
__pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
if (unlikely(__pyx_typedict_guard != __pyx_tp_dict_version)) {
__pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
}
#endif
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
}
#endif
}
/* … */
/* function exit code */
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_AddTraceback("pysndlib.clm.mus_any.cache_extend", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_7mus_any_9cache_extend(PyObject *__pyx_v_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_7mus_any_8cache_extend, "\n :meta private:\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_7mus_any_9cache_extend = {"cache_extend", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_7mus_any_9cache_extend, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_7mus_any_8cache_extend};
static PyObject *__pyx_pw_8pysndlib_3clm_7mus_any_9cache_extend(PyObject *__pyx_v_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
PyObject *__pyx_v_obj = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("cache_extend (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_obj,0};
PyObject* values[1] = {0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_obj)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 261, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "cache_extend") < 0)) __PYX_ERR(0, 261, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 1)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
}
__pyx_v_obj = values[0];
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("cache_extend", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 261, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.mus_any.cache_extend", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_8pysndlib_3clm_7mus_any_8cache_extend(((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_v_self), __pyx_v_obj);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_7mus_any_8cache_extend(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_self, PyObject *__pyx_v_obj) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8pysndlib_3clm_7mus_any_cache_extend(__pyx_v_self, __pyx_v_obj, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 261, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("pysndlib.clm.mus_any.cache_extend", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_43 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_7mus_any_9cache_extend, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_mus_any_cache_extend, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__126)); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 261, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_8pysndlib_3clm_mus_any, __pyx_n_s_cache_extend, __pyx_t_43) < 0) __PYX_ERR(0, 261, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
PyType_Modified(__pyx_ptype_8pysndlib_3clm_mus_any);
/* … */
__pyx_codeobj__126 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__124, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_cache_extend, 261, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__126)) __PYX_ERR(0, 261, __pyx_L1_error)
0262: """
0263: :meta private:
0264: """
+0265: self._cache.extend(obj)
if (unlikely(__pyx_v_self->_cache == Py_None)) {
PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "extend");
__PYX_ERR(0, 265, __pyx_L1_error)
}
__pyx_t_6 = __Pyx_PyList_Extend(__pyx_v_self->_cache, __pyx_v_obj); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(0, 265, __pyx_L1_error)
0266:
0267: # this stuff with view.array is to work around an apparent bug when automatic string handling is turned on
0268: # https://github.com/cython/cython/issues/4521
+0269: cpdef set_up_data(self , cython.int length=0):
static PyObject *__pyx_pw_8pysndlib_3clm_7mus_any_11set_up_data(PyObject *__pyx_v_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyObject *__pyx_f_8pysndlib_3clm_7mus_any_set_up_data(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_self, int __pyx_skip_dispatch, struct __pyx_opt_args_8pysndlib_3clm_7mus_any_set_up_data *__pyx_optional_args) {
int __pyx_v_length = ((int)0);
struct __pyx_array_obj *__pyx_v_arr = 0;
mus_long_t __pyx_v_size;
PyObject *__pyx_r = NULL;
if (__pyx_optional_args) {
if (__pyx_optional_args->__pyx_n > 0) {
__pyx_v_length = __pyx_optional_args->length;
}
}
/* Check if called by wrapper */
if (unlikely(__pyx_skip_dispatch)) ;
/* Check if overridden in Python */
else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || __Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
PY_UINT64_T __pyx_typedict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
#endif
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_set_up_data); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 269, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
if (!__Pyx_IsSameCFunction(__pyx_t_1, (void*) __pyx_pw_8pysndlib_3clm_7mus_any_11set_up_data)) {
__Pyx_XDECREF(__pyx_r);
__pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_length); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 269, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__Pyx_INCREF(__pyx_t_1);
__pyx_t_4 = __pyx_t_1; __pyx_t_5 = NULL;
__pyx_t_6 = 0;
#if CYTHON_UNPACK_METHODS
if (unlikely(PyMethod_Check(__pyx_t_4))) {
__pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
if (likely(__pyx_t_5)) {
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
__Pyx_INCREF(__pyx_t_5);
__Pyx_INCREF(function);
__Pyx_DECREF_SET(__pyx_t_4, function);
__pyx_t_6 = 1;
}
}
#endif
{
PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_t_3};
__pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6);
__Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 269, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
}
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
goto __pyx_L0;
}
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
__pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
__pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
if (unlikely(__pyx_typedict_guard != __pyx_tp_dict_version)) {
__pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
}
#endif
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
}
#endif
}
/* … */
/* function exit code */
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_XDECREF(__pyx_t_5);
__Pyx_AddTraceback("pysndlib.clm.mus_any.set_up_data", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XDECREF((PyObject *)__pyx_v_arr);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_7mus_any_11set_up_data(PyObject *__pyx_v_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_7mus_any_10set_up_data, "\n :meta private:\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_7mus_any_11set_up_data = {"set_up_data", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_7mus_any_11set_up_data, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_7mus_any_10set_up_data};
static PyObject *__pyx_pw_8pysndlib_3clm_7mus_any_11set_up_data(PyObject *__pyx_v_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
int __pyx_v_length;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("set_up_data (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_length,0};
PyObject* values[1] = {0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_length);
if (value) { values[0] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 269, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "set_up_data") < 0)) __PYX_ERR(0, 269, __pyx_L3_error)
}
} else {
switch (__pyx_nargs) {
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
}
if (values[0]) {
__pyx_v_length = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_length == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 269, __pyx_L3_error)
} else {
__pyx_v_length = ((int)0);
}
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("set_up_data", 0, 0, 1, __pyx_nargs); __PYX_ERR(0, 269, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.mus_any.set_up_data", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_8pysndlib_3clm_7mus_any_10set_up_data(((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_v_self), __pyx_v_length);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_7mus_any_10set_up_data(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_self, int __pyx_v_length) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_2.__pyx_n = 1;
__pyx_t_2.length = __pyx_v_length;
__pyx_t_1 = __pyx_vtabptr_8pysndlib_3clm_mus_any->set_up_data(__pyx_v_self, 1, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 269, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("pysndlib.clm.mus_any.set_up_data", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_tuple__127 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_length); if (unlikely(!__pyx_tuple__127)) __PYX_ERR(0, 269, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__127);
__Pyx_GIVEREF(__pyx_tuple__127);
__pyx_codeobj__128 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__127, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_set_up_data, 269, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__128)) __PYX_ERR(0, 269, __pyx_L1_error)
/* … */
__pyx_t_43 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_7mus_any_11set_up_data, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_mus_any_set_up_data, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__128)); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 269, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
__Pyx_CyFunction_SetDefaultsTuple(__pyx_t_43, __pyx_tuple__129);
if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_8pysndlib_3clm_mus_any, __pyx_n_s_set_up_data, __pyx_t_43) < 0) __PYX_ERR(0, 269, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
PyType_Modified(__pyx_ptype_8pysndlib_3clm_mus_any);
__pyx_tuple__129 = PyTuple_Pack(1, __pyx_int_0); if (unlikely(!__pyx_tuple__129)) __PYX_ERR(0, 269, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__129);
__Pyx_GIVEREF(__pyx_tuple__129);
0270: """
0271: :meta private:
0272: """
+0273: cdef view.array arr = None
__Pyx_INCREF(Py_None);
__pyx_v_arr = ((struct __pyx_array_obj *)Py_None);
+0274: cdef cclm.mus_long_t size = cclm.mus_length(self._ptr)
__pyx_v_size = mus_length(__pyx_v_self->_ptr);
0275:
+0276: if cclm.mus_is_env(self._ptr):
__pyx_t_7 = mus_is_env(__pyx_v_self->_ptr);
if (__pyx_t_7) {
/* … */
}
+0277: size = length
__pyx_v_size = __pyx_v_length;
0278:
0279:
+0280: if size > 0:
__pyx_t_7 = (__pyx_v_size > 0);
if (__pyx_t_7) {
/* … */
goto __pyx_L4;
}
+0281: self._data_ptr = cclm.mus_data(self._ptr)
__pyx_v_self->_data_ptr = mus_data(__pyx_v_self->_ptr);
+0282: arr = view.array(shape=(size,),itemsize=sizeof(double), format='d', allocate_buffer=False)
__pyx_t_1 = __Pyx_PyDict_NewPresized(4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 282, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyInt_From_int64_t(__pyx_v_size); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 282, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 282, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_GIVEREF(__pyx_t_2); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2)) __PYX_ERR(0, 282, __pyx_L1_error); __pyx_t_2 = 0; if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_shape, __pyx_t_4) < 0) __PYX_ERR(0, 282, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = __Pyx_PyInt_FromSize_t((sizeof(double))); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 282, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_itemsize, __pyx_t_4) < 0) __PYX_ERR(0, 282, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_format, __pyx_n_s_d) < 0) __PYX_ERR(0, 282, __pyx_L1_error) if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_allocate_buffer, Py_False) < 0) __PYX_ERR(0, 282, __pyx_L1_error) __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)__pyx_array_type), __pyx_empty_tuple, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 282, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF_SET(__pyx_v_arr, ((struct __pyx_array_obj *)__pyx_t_4)); __pyx_t_4 = 0;
+0283: arr.data = <char*>self._data_ptr
__pyx_v_arr->data = ((char *)__pyx_v_self->_data_ptr);
+0284: self._data = np.asarray(arr)
__Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 284, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_asarray); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 284, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = NULL; __pyx_t_6 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_2))) { __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_1)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_1); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); __pyx_t_6 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_1, ((PyObject *)__pyx_v_arr)}; __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6); __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 284, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 284, __pyx_L1_error) __Pyx_GIVEREF(__pyx_t_4); __Pyx_GOTREF((PyObject *)__pyx_v_self->_data); __Pyx_DECREF((PyObject *)__pyx_v_self->_data); __pyx_v_self->_data = ((PyArrayObject *)__pyx_t_4); __pyx_t_4 = 0;
0285: else:
+0286: self._data = None
/*else*/ {
__Pyx_INCREF(Py_None);
__Pyx_GIVEREF(Py_None);
__Pyx_GOTREF((PyObject *)__pyx_v_self->_data);
__Pyx_DECREF((PyObject *)__pyx_v_self->_data);
__pyx_v_self->_data = ((PyArrayObject *)Py_None);
}
__pyx_L4:;
0287:
+0288: cpdef set_up_xcoeffs(self):
static PyObject *__pyx_pw_8pysndlib_3clm_7mus_any_13set_up_xcoeffs(PyObject *__pyx_v_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyObject *__pyx_f_8pysndlib_3clm_7mus_any_set_up_xcoeffs(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_self, int __pyx_skip_dispatch) {
mus_long_t __pyx_v_size;
struct __pyx_array_obj *__pyx_v_arr = 0;
PyObject *__pyx_r = NULL;
/* Check if called by wrapper */
if (unlikely(__pyx_skip_dispatch)) ;
/* Check if overridden in Python */
else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || __Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
PY_UINT64_T __pyx_typedict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
#endif
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_set_up_xcoeffs); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 288, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
if (!__Pyx_IsSameCFunction(__pyx_t_1, (void*) __pyx_pw_8pysndlib_3clm_7mus_any_13set_up_xcoeffs)) {
__Pyx_XDECREF(__pyx_r);
__Pyx_INCREF(__pyx_t_1);
__pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
__pyx_t_5 = 0;
#if CYTHON_UNPACK_METHODS
if (unlikely(PyMethod_Check(__pyx_t_3))) {
__pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
if (likely(__pyx_t_4)) {
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
__Pyx_INCREF(__pyx_t_4);
__Pyx_INCREF(function);
__Pyx_DECREF_SET(__pyx_t_3, function);
__pyx_t_5 = 1;
}
}
#endif
{
PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL};
__pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 0+__pyx_t_5);
__Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 288, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
}
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
goto __pyx_L0;
}
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
__pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
__pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
if (unlikely(__pyx_typedict_guard != __pyx_tp_dict_version)) {
__pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
}
#endif
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
}
#endif
}
/* … */
/* function exit code */
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_AddTraceback("pysndlib.clm.mus_any.set_up_xcoeffs", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XDECREF((PyObject *)__pyx_v_arr);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_7mus_any_13set_up_xcoeffs(PyObject *__pyx_v_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_7mus_any_12set_up_xcoeffs, "\n :meta private:\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_7mus_any_13set_up_xcoeffs = {"set_up_xcoeffs", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_7mus_any_13set_up_xcoeffs, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_7mus_any_12set_up_xcoeffs};
static PyObject *__pyx_pw_8pysndlib_3clm_7mus_any_13set_up_xcoeffs(PyObject *__pyx_v_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("set_up_xcoeffs (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
if (unlikely(__pyx_nargs > 0)) {
__Pyx_RaiseArgtupleInvalid("set_up_xcoeffs", 1, 0, 0, __pyx_nargs); return NULL;}
if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "set_up_xcoeffs", 0))) return NULL;
__pyx_r = __pyx_pf_8pysndlib_3clm_7mus_any_12set_up_xcoeffs(((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_7mus_any_12set_up_xcoeffs(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8pysndlib_3clm_7mus_any_set_up_xcoeffs(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 288, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("pysndlib.clm.mus_any.set_up_xcoeffs", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_43 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_7mus_any_13set_up_xcoeffs, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_mus_any_set_up_xcoeffs, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__130)); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 288, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_8pysndlib_3clm_mus_any, __pyx_n_s_set_up_xcoeffs, __pyx_t_43) < 0) __PYX_ERR(0, 288, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
PyType_Modified(__pyx_ptype_8pysndlib_3clm_mus_any);
/* … */
__pyx_codeobj__130 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__91, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_set_up_xcoeffs, 288, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__130)) __PYX_ERR(0, 288, __pyx_L1_error)
0289: """
0290: :meta private:
0291: """
+0292: cdef cclm.mus_long_t size = 0
__pyx_v_size = 0;
+0293: cdef view.array arr = None
__Pyx_INCREF(Py_None);
__pyx_v_arr = ((struct __pyx_array_obj *)Py_None);
0294: #if simple filter the size will always be 3 and we do not want to
0295: #allocate a buffer
0296: # in other cases mus_order will be size and we do want to allocate
0297:
+0298: if is_simple_filter(self):
__pyx_t_6 = __pyx_f_8pysndlib_3clm_is_simple_filter(__pyx_v_self); if (unlikely(__pyx_t_6 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 298, __pyx_L1_error) if (__pyx_t_6) { /* … */ goto __pyx_L3; }
+0299: size = 3
__pyx_v_size = 3;
+0300: self._xcoeffs_ptr = cclm.mus_xcoeffs(self._ptr)
__pyx_v_self->_xcoeffs_ptr = mus_xcoeffs(__pyx_v_self->_ptr);
+0301: arr = view.array(shape=(size,),itemsize=sizeof(double), format='d', allocate_buffer=False)
__pyx_t_1 = __Pyx_PyDict_NewPresized(4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 301, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyInt_From_int64_t(__pyx_v_size); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 301, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 301, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_GIVEREF(__pyx_t_2); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2)) __PYX_ERR(0, 301, __pyx_L1_error); __pyx_t_2 = 0; if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_shape, __pyx_t_3) < 0) __PYX_ERR(0, 301, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = __Pyx_PyInt_FromSize_t((sizeof(double))); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 301, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_itemsize, __pyx_t_3) < 0) __PYX_ERR(0, 301, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_format, __pyx_n_s_d) < 0) __PYX_ERR(0, 301, __pyx_L1_error) if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_allocate_buffer, Py_False) < 0) __PYX_ERR(0, 301, __pyx_L1_error) __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)__pyx_array_type), __pyx_empty_tuple, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 301, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF_SET(__pyx_v_arr, ((struct __pyx_array_obj *)__pyx_t_3)); __pyx_t_3 = 0;
+0302: arr.data = <char*>self._xcoeffs_ptr
__pyx_v_arr->data = ((char *)__pyx_v_self->_xcoeffs_ptr);
+0303: self._xcoeffs = np.asarray(arr)
__Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 303, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_asarray); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 303, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = NULL; __pyx_t_5 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_2))) { __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_1)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_1); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); __pyx_t_5 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_1, ((PyObject *)__pyx_v_arr)}; __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5); __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 303, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 303, __pyx_L1_error) __Pyx_GIVEREF(__pyx_t_3); __Pyx_GOTREF((PyObject *)__pyx_v_self->_xcoeffs); __Pyx_DECREF((PyObject *)__pyx_v_self->_xcoeffs); __pyx_v_self->_xcoeffs = ((PyArrayObject *)__pyx_t_3); __pyx_t_3 = 0;
0304: #print('setup xcoeffs', size,is_simple_filter(self), self._xcoeffs, arr)
0305: else:
+0306: size = cclm.mus_order(self._ptr)
/*else*/ {
__pyx_v_size = mus_order(__pyx_v_self->_ptr);
0307: #print(size)
+0308: self._xcoeffs_ptr = cclm.mus_xcoeffs(self._ptr)
__pyx_v_self->_xcoeffs_ptr = mus_xcoeffs(__pyx_v_self->_ptr);
0309: # setting allocate_buffer to false because array should be already allocated (?_)
0310: # this means tis could be simplified to just us esize if simple filter all the rest would besame
+0311: arr = view.array(shape=(size,),itemsize=sizeof(double), format='d', allocate_buffer=False)
__pyx_t_3 = __Pyx_PyDict_NewPresized(4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 311, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_2 = __Pyx_PyInt_From_int64_t(__pyx_v_size); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 311, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 311, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_GIVEREF(__pyx_t_2); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2)) __PYX_ERR(0, 311, __pyx_L1_error); __pyx_t_2 = 0; if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_shape, __pyx_t_1) < 0) __PYX_ERR(0, 311, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_PyInt_FromSize_t((sizeof(double))); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 311, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_itemsize, __pyx_t_1) < 0) __PYX_ERR(0, 311, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_format, __pyx_n_s_d) < 0) __PYX_ERR(0, 311, __pyx_L1_error) if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_allocate_buffer, Py_False) < 0) __PYX_ERR(0, 311, __pyx_L1_error) __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_array_type), __pyx_empty_tuple, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 311, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF_SET(__pyx_v_arr, ((struct __pyx_array_obj *)__pyx_t_1)); __pyx_t_1 = 0;
+0312: arr.data = <char*>self._xcoeffs_ptr
__pyx_v_arr->data = ((char *)__pyx_v_self->_xcoeffs_ptr);
+0313: self._xcoeffs = np.asarray(arr)
__Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 313, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_asarray); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 313, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = NULL; __pyx_t_5 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_2))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); __pyx_t_5 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_3, ((PyObject *)__pyx_v_arr)}; __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 313, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 313, __pyx_L1_error) __Pyx_GIVEREF(__pyx_t_1); __Pyx_GOTREF((PyObject *)__pyx_v_self->_xcoeffs); __Pyx_DECREF((PyObject *)__pyx_v_self->_xcoeffs); __pyx_v_self->_xcoeffs = ((PyArrayObject *)__pyx_t_1); __pyx_t_1 = 0; } __pyx_L3:;
0314:
+0315: cpdef set_up_ycoeffs(self):
static PyObject *__pyx_pw_8pysndlib_3clm_7mus_any_15set_up_ycoeffs(PyObject *__pyx_v_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyObject *__pyx_f_8pysndlib_3clm_7mus_any_set_up_ycoeffs(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_self, int __pyx_skip_dispatch) {
mus_long_t __pyx_v_size;
struct __pyx_array_obj *__pyx_v_arr = 0;
PyObject *__pyx_r = NULL;
/* Check if called by wrapper */
if (unlikely(__pyx_skip_dispatch)) ;
/* Check if overridden in Python */
else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || __Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
PY_UINT64_T __pyx_typedict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
#endif
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_set_up_ycoeffs); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 315, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
if (!__Pyx_IsSameCFunction(__pyx_t_1, (void*) __pyx_pw_8pysndlib_3clm_7mus_any_15set_up_ycoeffs)) {
__Pyx_XDECREF(__pyx_r);
__Pyx_INCREF(__pyx_t_1);
__pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
__pyx_t_5 = 0;
#if CYTHON_UNPACK_METHODS
if (unlikely(PyMethod_Check(__pyx_t_3))) {
__pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
if (likely(__pyx_t_4)) {
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
__Pyx_INCREF(__pyx_t_4);
__Pyx_INCREF(function);
__Pyx_DECREF_SET(__pyx_t_3, function);
__pyx_t_5 = 1;
}
}
#endif
{
PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL};
__pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 0+__pyx_t_5);
__Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 315, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
}
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
goto __pyx_L0;
}
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
__pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
__pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
if (unlikely(__pyx_typedict_guard != __pyx_tp_dict_version)) {
__pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
}
#endif
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
}
#endif
}
/* … */
/* function exit code */
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_AddTraceback("pysndlib.clm.mus_any.set_up_ycoeffs", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XDECREF((PyObject *)__pyx_v_arr);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_7mus_any_15set_up_ycoeffs(PyObject *__pyx_v_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_7mus_any_14set_up_ycoeffs, "\n :meta private:\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_7mus_any_15set_up_ycoeffs = {"set_up_ycoeffs", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_7mus_any_15set_up_ycoeffs, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_7mus_any_14set_up_ycoeffs};
static PyObject *__pyx_pw_8pysndlib_3clm_7mus_any_15set_up_ycoeffs(PyObject *__pyx_v_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("set_up_ycoeffs (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
if (unlikely(__pyx_nargs > 0)) {
__Pyx_RaiseArgtupleInvalid("set_up_ycoeffs", 1, 0, 0, __pyx_nargs); return NULL;}
if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "set_up_ycoeffs", 0))) return NULL;
__pyx_r = __pyx_pf_8pysndlib_3clm_7mus_any_14set_up_ycoeffs(((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_7mus_any_14set_up_ycoeffs(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8pysndlib_3clm_7mus_any_set_up_ycoeffs(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 315, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("pysndlib.clm.mus_any.set_up_ycoeffs", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_43 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_7mus_any_15set_up_ycoeffs, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_mus_any_set_up_ycoeffs, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__131)); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 315, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_8pysndlib_3clm_mus_any, __pyx_n_s_set_up_ycoeffs, __pyx_t_43) < 0) __PYX_ERR(0, 315, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
PyType_Modified(__pyx_ptype_8pysndlib_3clm_mus_any);
/* … */
__pyx_codeobj__131 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__91, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_set_up_ycoeffs, 315, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__131)) __PYX_ERR(0, 315, __pyx_L1_error)
0316: """
0317: :meta private:
0318: """
+0319: cdef cclm.mus_long_t size = 0
__pyx_v_size = 0;
+0320: cdef view.array arr = None
__Pyx_INCREF(Py_None);
__pyx_v_arr = ((struct __pyx_array_obj *)Py_None);
0321: #if simple filter the size will always be 3 and we do not want to
0322: #allocate a buffer
0323: # in other cases mus_order will be size and we do want to allocate
0324:
+0325: if is_simple_filter(self):
__pyx_t_6 = __pyx_f_8pysndlib_3clm_is_simple_filter(__pyx_v_self); if (unlikely(__pyx_t_6 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 325, __pyx_L1_error) if (__pyx_t_6) { /* … */ goto __pyx_L3; }
+0326: size = 3
__pyx_v_size = 3;
+0327: self._ycoeffs_ptr = cclm.mus_ycoeffs(self._ptr)
__pyx_v_self->_ycoeffs_ptr = mus_ycoeffs(__pyx_v_self->_ptr);
+0328: arr = view.array(shape=(size,),itemsize=sizeof(double), format='d', allocate_buffer=False)
__pyx_t_1 = __Pyx_PyDict_NewPresized(4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 328, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyInt_From_int64_t(__pyx_v_size); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 328, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 328, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_GIVEREF(__pyx_t_2); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2)) __PYX_ERR(0, 328, __pyx_L1_error); __pyx_t_2 = 0; if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_shape, __pyx_t_3) < 0) __PYX_ERR(0, 328, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = __Pyx_PyInt_FromSize_t((sizeof(double))); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 328, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_itemsize, __pyx_t_3) < 0) __PYX_ERR(0, 328, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_format, __pyx_n_s_d) < 0) __PYX_ERR(0, 328, __pyx_L1_error) if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_allocate_buffer, Py_False) < 0) __PYX_ERR(0, 328, __pyx_L1_error) __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)__pyx_array_type), __pyx_empty_tuple, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 328, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF_SET(__pyx_v_arr, ((struct __pyx_array_obj *)__pyx_t_3)); __pyx_t_3 = 0;
+0329: arr.data = <char*>self._ycoeffs_ptr
__pyx_v_arr->data = ((char *)__pyx_v_self->_ycoeffs_ptr);
+0330: self._ycoeffs = np.asarray(arr)
__Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 330, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_asarray); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 330, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = NULL; __pyx_t_5 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_2))) { __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_1)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_1); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); __pyx_t_5 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_1, ((PyObject *)__pyx_v_arr)}; __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5); __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 330, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 330, __pyx_L1_error) __Pyx_GIVEREF(__pyx_t_3); __Pyx_GOTREF((PyObject *)__pyx_v_self->_ycoeffs); __Pyx_DECREF((PyObject *)__pyx_v_self->_ycoeffs); __pyx_v_self->_ycoeffs = ((PyArrayObject *)__pyx_t_3); __pyx_t_3 = 0;
0331: # print('setup ycoeffs', size,is_simple_filter(self), self._xcoeffs, arr)
0332: else:
+0333: size = cclm.mus_order(self._ptr)
/*else*/ {
__pyx_v_size = mus_order(__pyx_v_self->_ptr);
0334: #print(size)
+0335: self._ycoeffs_ptr = cclm.mus_ycoeffs(self._ptr)
__pyx_v_self->_ycoeffs_ptr = mus_ycoeffs(__pyx_v_self->_ptr);
+0336: arr = view.array(shape=(size,),itemsize=sizeof(double), format='d', allocate_buffer=False)
__pyx_t_3 = __Pyx_PyDict_NewPresized(4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 336, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_2 = __Pyx_PyInt_From_int64_t(__pyx_v_size); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 336, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 336, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_GIVEREF(__pyx_t_2); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2)) __PYX_ERR(0, 336, __pyx_L1_error); __pyx_t_2 = 0; if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_shape, __pyx_t_1) < 0) __PYX_ERR(0, 336, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_PyInt_FromSize_t((sizeof(double))); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 336, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_itemsize, __pyx_t_1) < 0) __PYX_ERR(0, 336, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_format, __pyx_n_s_d) < 0) __PYX_ERR(0, 336, __pyx_L1_error) if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_allocate_buffer, Py_False) < 0) __PYX_ERR(0, 336, __pyx_L1_error) __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_array_type), __pyx_empty_tuple, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 336, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF_SET(__pyx_v_arr, ((struct __pyx_array_obj *)__pyx_t_1)); __pyx_t_1 = 0;
+0337: arr.data = <char*>self._ycoeffs_ptr
__pyx_v_arr->data = ((char *)__pyx_v_self->_ycoeffs_ptr);
+0338: self._ycoeffs = np.asarray(arr)
__Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 338, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_asarray); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 338, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = NULL; __pyx_t_5 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_2))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); __pyx_t_5 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_3, ((PyObject *)__pyx_v_arr)}; __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 338, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 338, __pyx_L1_error) __Pyx_GIVEREF(__pyx_t_1); __Pyx_GOTREF((PyObject *)__pyx_v_self->_ycoeffs); __Pyx_DECREF((PyObject *)__pyx_v_self->_ycoeffs); __pyx_v_self->_ycoeffs = ((PyArrayObject *)__pyx_t_1); __pyx_t_1 = 0; } __pyx_L3:;
0339:
0340:
+0341: cpdef set_up_pv_data(self):
static PyObject *__pyx_pw_8pysndlib_3clm_7mus_any_17set_up_pv_data(PyObject *__pyx_v_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyObject *__pyx_f_8pysndlib_3clm_7mus_any_set_up_pv_data(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_self, int __pyx_skip_dispatch) {
mus_long_t __pyx_v_size;
struct __pyx_array_obj *__pyx_v_pvai = 0;
struct __pyx_array_obj *__pyx_v_pva = 0;
struct __pyx_array_obj *__pyx_v_pvf = 0;
struct __pyx_array_obj *__pyx_v_pvp = 0;
struct __pyx_array_obj *__pyx_v_pvpi = 0;
PyObject *__pyx_r = NULL;
/* Check if called by wrapper */
if (unlikely(__pyx_skip_dispatch)) ;
/* Check if overridden in Python */
else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || __Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
PY_UINT64_T __pyx_typedict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
#endif
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_set_up_pv_data); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 341, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
if (!__Pyx_IsSameCFunction(__pyx_t_1, (void*) __pyx_pw_8pysndlib_3clm_7mus_any_17set_up_pv_data)) {
__Pyx_XDECREF(__pyx_r);
__Pyx_INCREF(__pyx_t_1);
__pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
__pyx_t_5 = 0;
#if CYTHON_UNPACK_METHODS
if (unlikely(PyMethod_Check(__pyx_t_3))) {
__pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
if (likely(__pyx_t_4)) {
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
__Pyx_INCREF(__pyx_t_4);
__Pyx_INCREF(function);
__Pyx_DECREF_SET(__pyx_t_3, function);
__pyx_t_5 = 1;
}
}
#endif
{
PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL};
__pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 0+__pyx_t_5);
__Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 341, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
}
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
goto __pyx_L0;
}
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
__pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
__pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
if (unlikely(__pyx_typedict_guard != __pyx_tp_dict_version)) {
__pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
}
#endif
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
}
#endif
}
/* … */
/* function exit code */
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_AddTraceback("pysndlib.clm.mus_any.set_up_pv_data", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XDECREF((PyObject *)__pyx_v_pvai);
__Pyx_XDECREF((PyObject *)__pyx_v_pva);
__Pyx_XDECREF((PyObject *)__pyx_v_pvf);
__Pyx_XDECREF((PyObject *)__pyx_v_pvp);
__Pyx_XDECREF((PyObject *)__pyx_v_pvpi);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_7mus_any_17set_up_pv_data(PyObject *__pyx_v_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_7mus_any_16set_up_pv_data, "\n :meta private:\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_7mus_any_17set_up_pv_data = {"set_up_pv_data", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_7mus_any_17set_up_pv_data, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_7mus_any_16set_up_pv_data};
static PyObject *__pyx_pw_8pysndlib_3clm_7mus_any_17set_up_pv_data(PyObject *__pyx_v_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("set_up_pv_data (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
if (unlikely(__pyx_nargs > 0)) {
__Pyx_RaiseArgtupleInvalid("set_up_pv_data", 1, 0, 0, __pyx_nargs); return NULL;}
if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "set_up_pv_data", 0))) return NULL;
__pyx_r = __pyx_pf_8pysndlib_3clm_7mus_any_16set_up_pv_data(((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_7mus_any_16set_up_pv_data(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8pysndlib_3clm_7mus_any_set_up_pv_data(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 341, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("pysndlib.clm.mus_any.set_up_pv_data", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_43 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_7mus_any_17set_up_pv_data, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_mus_any_set_up_pv_data, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__132)); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 341, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_8pysndlib_3clm_mus_any, __pyx_n_s_set_up_pv_data, __pyx_t_43) < 0) __PYX_ERR(0, 341, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
PyType_Modified(__pyx_ptype_8pysndlib_3clm_mus_any);
/* … */
__pyx_codeobj__132 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__91, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_set_up_pv_data, 341, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__132)) __PYX_ERR(0, 341, __pyx_L1_error)
0342: """
0343: :meta private:
0344: """
+0345: cdef cclm.mus_long_t size = cclm.mus_length(self._ptr)
__pyx_v_size = mus_length(__pyx_v_self->_ptr);
0346:
+0347: self._pv_amp_increments_ptr = cclm.mus_phase_vocoder_amp_increments(self._ptr)
__pyx_v_self->_pv_amp_increments_ptr = mus_phase_vocoder_amp_increments(__pyx_v_self->_ptr);
+0348: cdef view.array pvai = view.array(shape=(size,),itemsize=sizeof(double), format='d', allocate_buffer=True)
__pyx_t_1 = __Pyx_PyDict_NewPresized(4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 348, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyInt_From_int64_t(__pyx_v_size); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 348, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 348, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_GIVEREF(__pyx_t_2); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2)) __PYX_ERR(0, 348, __pyx_L1_error); __pyx_t_2 = 0; if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_shape, __pyx_t_3) < 0) __PYX_ERR(0, 348, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = __Pyx_PyInt_FromSize_t((sizeof(double))); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 348, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_itemsize, __pyx_t_3) < 0) __PYX_ERR(0, 348, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_format, __pyx_n_s_d) < 0) __PYX_ERR(0, 348, __pyx_L1_error) if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_allocate_buffer, Py_True) < 0) __PYX_ERR(0, 348, __pyx_L1_error) __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)__pyx_array_type), __pyx_empty_tuple, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 348, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_pvai = ((struct __pyx_array_obj *)__pyx_t_3); __pyx_t_3 = 0;
+0349: pvai.data = <char*>self._pv_amp_increments_ptr
__pyx_v_pvai->data = ((char *)__pyx_v_self->_pv_amp_increments_ptr);
+0350: self._pv_amp_increments = np.asarray(pvai)
__Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 350, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_asarray); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 350, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = NULL; __pyx_t_5 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_2))) { __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_1)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_1); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); __pyx_t_5 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_1, ((PyObject *)__pyx_v_pvai)}; __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5); __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 350, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 350, __pyx_L1_error) __Pyx_GIVEREF(__pyx_t_3); __Pyx_GOTREF((PyObject *)__pyx_v_self->_pv_amp_increments); __Pyx_DECREF((PyObject *)__pyx_v_self->_pv_amp_increments); __pyx_v_self->_pv_amp_increments = ((PyArrayObject *)__pyx_t_3); __pyx_t_3 = 0;
+0351: self._pv_amp_increments.fill(0.0)
__pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->_pv_amp_increments), __pyx_n_s_fill); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 351, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_1 = NULL; __pyx_t_5 = 0; #if CYTHON_UNPACK_METHODS if (likely(PyMethod_Check(__pyx_t_2))) { __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_1)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_1); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); __pyx_t_5 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_float_0_0}; __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5); __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 351, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
0352:
+0353: self._pv_amps_ptr = cclm.mus_phase_vocoder_amps(self._ptr)
__pyx_v_self->_pv_amps_ptr = mus_phase_vocoder_amps(__pyx_v_self->_ptr);
+0354: cdef view.array pva = view.array(shape=(size // 2,),itemsize=sizeof(double), format='d', allocate_buffer=True)
__pyx_t_3 = __Pyx_PyDict_NewPresized(4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 354, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_2 = __Pyx_PyInt_From_int64_t(__Pyx_div_mus_long_t(__pyx_v_size, 2)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 354, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 354, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_GIVEREF(__pyx_t_2); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2)) __PYX_ERR(0, 354, __pyx_L1_error); __pyx_t_2 = 0; if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_shape, __pyx_t_1) < 0) __PYX_ERR(0, 354, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_PyInt_FromSize_t((sizeof(double))); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 354, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_itemsize, __pyx_t_1) < 0) __PYX_ERR(0, 354, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_format, __pyx_n_s_d) < 0) __PYX_ERR(0, 354, __pyx_L1_error) if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_allocate_buffer, Py_True) < 0) __PYX_ERR(0, 354, __pyx_L1_error) __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_array_type), __pyx_empty_tuple, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 354, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_pva = ((struct __pyx_array_obj *)__pyx_t_1); __pyx_t_1 = 0;
+0355: pva.data = <char*>self._pv_amps_ptr
__pyx_v_pva->data = ((char *)__pyx_v_self->_pv_amps_ptr);
+0356: self._pv_amps = np.asarray(pva)
__Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 356, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_asarray); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 356, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = NULL; __pyx_t_5 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_2))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); __pyx_t_5 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_3, ((PyObject *)__pyx_v_pva)}; __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 356, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 356, __pyx_L1_error) __Pyx_GIVEREF(__pyx_t_1); __Pyx_GOTREF((PyObject *)__pyx_v_self->_pv_amps); __Pyx_DECREF((PyObject *)__pyx_v_self->_pv_amps); __pyx_v_self->_pv_amps = ((PyArrayObject *)__pyx_t_1); __pyx_t_1 = 0;
+0357: self._pv_amps.fill(0.0)
__pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->_pv_amps), __pyx_n_s_fill); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 357, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = NULL; __pyx_t_5 = 0; #if CYTHON_UNPACK_METHODS if (likely(PyMethod_Check(__pyx_t_2))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); __pyx_t_5 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_float_0_0}; __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 357, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
0358:
+0359: self._pv_freqs_ptr = cclm.mus_phase_vocoder_freqs(self._ptr)
__pyx_v_self->_pv_freqs_ptr = mus_phase_vocoder_freqs(__pyx_v_self->_ptr);
+0360: cdef view.array pvf = view.array(shape=(size,),itemsize=sizeof(double), format='d', allocate_buffer=True)
__pyx_t_1 = __Pyx_PyDict_NewPresized(4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 360, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyInt_From_int64_t(__pyx_v_size); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 360, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 360, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_GIVEREF(__pyx_t_2); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2)) __PYX_ERR(0, 360, __pyx_L1_error); __pyx_t_2 = 0; if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_shape, __pyx_t_3) < 0) __PYX_ERR(0, 360, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = __Pyx_PyInt_FromSize_t((sizeof(double))); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 360, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_itemsize, __pyx_t_3) < 0) __PYX_ERR(0, 360, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_format, __pyx_n_s_d) < 0) __PYX_ERR(0, 360, __pyx_L1_error) if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_allocate_buffer, Py_True) < 0) __PYX_ERR(0, 360, __pyx_L1_error) __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)__pyx_array_type), __pyx_empty_tuple, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 360, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_pvf = ((struct __pyx_array_obj *)__pyx_t_3); __pyx_t_3 = 0;
+0361: pvf.data = <char*>self._pv_freqs_ptr
__pyx_v_pvf->data = ((char *)__pyx_v_self->_pv_freqs_ptr);
+0362: self._pv_freqs = np.asarray(pvf)
__Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 362, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_asarray); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 362, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = NULL; __pyx_t_5 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_2))) { __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_1)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_1); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); __pyx_t_5 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_1, ((PyObject *)__pyx_v_pvf)}; __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5); __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 362, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 362, __pyx_L1_error) __Pyx_GIVEREF(__pyx_t_3); __Pyx_GOTREF((PyObject *)__pyx_v_self->_pv_freqs); __Pyx_DECREF((PyObject *)__pyx_v_self->_pv_freqs); __pyx_v_self->_pv_freqs = ((PyArrayObject *)__pyx_t_3); __pyx_t_3 = 0;
+0363: self._pv_freqs.fill(0.0)
__pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->_pv_freqs), __pyx_n_s_fill); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 363, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_1 = NULL; __pyx_t_5 = 0; #if CYTHON_UNPACK_METHODS if (likely(PyMethod_Check(__pyx_t_2))) { __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_1)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_1); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); __pyx_t_5 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_float_0_0}; __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5); __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 363, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
0364:
+0365: self._pv_phases_ptr = cclm.mus_phase_vocoder_phases(self._ptr)
__pyx_v_self->_pv_phases_ptr = mus_phase_vocoder_phases(__pyx_v_self->_ptr);
+0366: cdef view.array pvp = view.array(shape=(size // 2,),itemsize=sizeof(double), format='d', allocate_buffer=True)
__pyx_t_3 = __Pyx_PyDict_NewPresized(4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 366, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_2 = __Pyx_PyInt_From_int64_t(__Pyx_div_mus_long_t(__pyx_v_size, 2)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 366, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 366, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_GIVEREF(__pyx_t_2); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2)) __PYX_ERR(0, 366, __pyx_L1_error); __pyx_t_2 = 0; if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_shape, __pyx_t_1) < 0) __PYX_ERR(0, 366, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_PyInt_FromSize_t((sizeof(double))); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 366, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_itemsize, __pyx_t_1) < 0) __PYX_ERR(0, 366, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_format, __pyx_n_s_d) < 0) __PYX_ERR(0, 366, __pyx_L1_error) if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_allocate_buffer, Py_True) < 0) __PYX_ERR(0, 366, __pyx_L1_error) __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_array_type), __pyx_empty_tuple, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 366, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_pvp = ((struct __pyx_array_obj *)__pyx_t_1); __pyx_t_1 = 0;
+0367: pvp.data = <char*>self._pv_phases_ptr
__pyx_v_pvp->data = ((char *)__pyx_v_self->_pv_phases_ptr);
+0368: self._pv_phases = np.asarray(pvp)
__Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 368, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_asarray); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 368, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = NULL; __pyx_t_5 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_2))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); __pyx_t_5 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_3, ((PyObject *)__pyx_v_pvp)}; __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 368, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 368, __pyx_L1_error) __Pyx_GIVEREF(__pyx_t_1); __Pyx_GOTREF((PyObject *)__pyx_v_self->_pv_phases); __Pyx_DECREF((PyObject *)__pyx_v_self->_pv_phases); __pyx_v_self->_pv_phases = ((PyArrayObject *)__pyx_t_1); __pyx_t_1 = 0;
+0369: self._pv_phases.fill(0.0)
__pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->_pv_phases), __pyx_n_s_fill); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 369, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = NULL; __pyx_t_5 = 0; #if CYTHON_UNPACK_METHODS if (likely(PyMethod_Check(__pyx_t_2))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); __pyx_t_5 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_float_0_0}; __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 369, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
0370:
+0371: self._pv_phase_increments_ptr = cclm.mus_phase_vocoder_phase_increments(self._ptr)
__pyx_v_self->_pv_phase_increments_ptr = mus_phase_vocoder_phase_increments(__pyx_v_self->_ptr);
+0372: cdef view.array pvpi = view.array(shape=(size // 2,),itemsize=sizeof(double), format='d', allocate_buffer=True)
__pyx_t_1 = __Pyx_PyDict_NewPresized(4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 372, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyInt_From_int64_t(__Pyx_div_mus_long_t(__pyx_v_size, 2)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 372, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 372, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_GIVEREF(__pyx_t_2); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2)) __PYX_ERR(0, 372, __pyx_L1_error); __pyx_t_2 = 0; if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_shape, __pyx_t_3) < 0) __PYX_ERR(0, 372, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = __Pyx_PyInt_FromSize_t((sizeof(double))); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 372, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_itemsize, __pyx_t_3) < 0) __PYX_ERR(0, 372, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_format, __pyx_n_s_d) < 0) __PYX_ERR(0, 372, __pyx_L1_error) if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_allocate_buffer, Py_True) < 0) __PYX_ERR(0, 372, __pyx_L1_error) __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)__pyx_array_type), __pyx_empty_tuple, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 372, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_pvpi = ((struct __pyx_array_obj *)__pyx_t_3); __pyx_t_3 = 0;
+0373: pvpi.data = <char*>self._pv_phase_increments_ptr
__pyx_v_pvpi->data = ((char *)__pyx_v_self->_pv_phase_increments_ptr);
+0374: self._pv_phase_increments = np.asarray(pvpi)
__Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 374, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_asarray); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 374, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = NULL; __pyx_t_5 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_2))) { __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_1)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_1); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); __pyx_t_5 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_1, ((PyObject *)__pyx_v_pvpi)}; __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5); __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 374, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 374, __pyx_L1_error) __Pyx_GIVEREF(__pyx_t_3); __Pyx_GOTREF((PyObject *)__pyx_v_self->_pv_phase_increments); __Pyx_DECREF((PyObject *)__pyx_v_self->_pv_phase_increments); __pyx_v_self->_pv_phase_increments = ((PyArrayObject *)__pyx_t_3); __pyx_t_3 = 0;
+0375: self._pv_phase_increments.fill(0.0)
__pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->_pv_phase_increments), __pyx_n_s_fill); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 375, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_1 = NULL; __pyx_t_5 = 0; #if CYTHON_UNPACK_METHODS if (likely(PyMethod_Check(__pyx_t_2))) { __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_1)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_1); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); __pyx_t_5 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_float_0_0}; __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5); __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 375, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
0376:
+0377: def __call__(self, arg1=0.0, arg2=0.0):
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_7mus_any_19__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_8pysndlib_3clm_7mus_any_19__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_arg1 = 0;
PyObject *__pyx_v_arg2 = 0;
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__call__ (wrapper)", 0);
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_arg1,&__pyx_n_s_arg2,0};
PyObject* values[2] = {0,0};
values[0] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)__pyx_float_0_0));
values[1] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)__pyx_float_0_0));
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 2: values[1] = __Pyx_Arg_VARARGS(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_VARARGS(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_arg1);
if (value) { values[0] = __Pyx_Arg_NewRef_VARARGS(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 377, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 1:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_arg2);
if (value) { values[1] = __Pyx_Arg_NewRef_VARARGS(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 377, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__call__") < 0)) __PYX_ERR(0, 377, __pyx_L3_error)
}
} else {
switch (__pyx_nargs) {
case 2: values[1] = __Pyx_Arg_VARARGS(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
}
__pyx_v_arg1 = values[0];
__pyx_v_arg2 = values[1];
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("__call__", 0, 0, 2, __pyx_nargs); __PYX_ERR(0, 377, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.mus_any.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_8pysndlib_3clm_7mus_any_18__call__(((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_v_self), __pyx_v_arg1, __pyx_v_arg2);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_7mus_any_18__call__(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_self, PyObject *__pyx_v_arg1, PyObject *__pyx_v_arg2) {
PyObject *__pyx_r = NULL;
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_3);
__Pyx_AddTraceback("pysndlib.clm.mus_any.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
+0378: return cclm.mus_apply(self._ptr, arg1,arg2)
__Pyx_XDECREF(__pyx_r); __pyx_t_1 = __pyx_PyFloat_AsDouble(__pyx_v_arg1); if (unlikely((__pyx_t_1 == ((mus_float_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 378, __pyx_L1_error) __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_v_arg2); if (unlikely((__pyx_t_2 == ((mus_float_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 378, __pyx_L1_error) __pyx_t_3 = PyFloat_FromDouble(mus_apply(__pyx_v_self->_ptr, __pyx_t_1, __pyx_t_2)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 378, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_r = __pyx_t_3; __pyx_t_3 = 0; goto __pyx_L0;
0379:
+0380: def __str__(self):
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_7mus_any_21__str__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8pysndlib_3clm_7mus_any_21__str__(PyObject *__pyx_v_self) {
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__str__ (wrapper)", 0);
__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
__pyx_r = __pyx_pf_8pysndlib_3clm_7mus_any_20__str__(((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_7mus_any_20__str__(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_self) {
PyObject *__pyx_r = NULL;
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_AddTraceback("pysndlib.clm.mus_any.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
+0381: return f'{mus_any} {cclm.mus_describe(self._ptr)}'
__Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 381, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = 0; __pyx_t_3 = 127; __pyx_t_4 = __Pyx_PyObject_FormatSimple(((PyObject *)__pyx_ptype_8pysndlib_3clm_mus_any), __pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 381, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_3 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) > __pyx_t_3) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) : __pyx_t_3; __pyx_t_2 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4); __pyx_t_4 = 0; __Pyx_INCREF(__pyx_kp_u__17); __pyx_t_2 += 1; __Pyx_GIVEREF(__pyx_kp_u__17); PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_kp_u__17); __pyx_t_4 = __Pyx_PyUnicode_FromString(mus_describe(__pyx_v_self->_ptr)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 381, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_3 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) > __pyx_t_3) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) : __pyx_t_3; __pyx_t_2 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = __Pyx_PyUnicode_Join(__pyx_t_1, 3, __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 381, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_r = __pyx_t_4; __pyx_t_4 = 0; goto __pyx_L0;
0382:
+0383: def mus_reset(self):
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_7mus_any_23mus_reset(PyObject *__pyx_v_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_8pysndlib_3clm_7mus_any_23mus_reset = {"mus_reset", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_7mus_any_23mus_reset, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_8pysndlib_3clm_7mus_any_23mus_reset(PyObject *__pyx_v_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("mus_reset (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
if (unlikely(__pyx_nargs > 0)) {
__Pyx_RaiseArgtupleInvalid("mus_reset", 1, 0, 0, __pyx_nargs); return NULL;}
if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "mus_reset", 0))) return NULL;
__pyx_r = __pyx_pf_8pysndlib_3clm_7mus_any_22mus_reset(((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_7mus_any_22mus_reset(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_self) {
PyObject *__pyx_r = NULL;
/* … */
/* function exit code */
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_43 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_7mus_any_23mus_reset, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_mus_any_mus_reset, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__133)); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 383, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_8pysndlib_3clm_mus_any, __pyx_n_s_mus_reset, __pyx_t_43) < 0) __PYX_ERR(0, 383, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
PyType_Modified(__pyx_ptype_8pysndlib_3clm_mus_any);
/* … */
__pyx_codeobj__133 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__91, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_mus_reset, 383, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__133)) __PYX_ERR(0, 383, __pyx_L1_error)
+0384: cclm.mus_reset(self._ptr)
mus_reset(__pyx_v_self->_ptr);
0385:
+0386: @property
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_7mus_any_13mus_frequency_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8pysndlib_3clm_7mus_any_13mus_frequency_1__get__(PyObject *__pyx_v_self) {
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
__pyx_r = __pyx_pf_8pysndlib_3clm_7mus_any_13mus_frequency___get__(((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_7mus_any_13mus_frequency___get__(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_self) {
PyObject *__pyx_r = NULL;
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("pysndlib.clm.mus_any.mus_frequency.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
0387: def mus_frequency(self):
0388: """
0389: frequency (hz), float
0390: """
+0391: return cclm.mus_frequency(self._ptr)
__Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyFloat_FromDouble(mus_frequency(__pyx_v_self->_ptr)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 391, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
0392:
+0393: @mus_frequency.setter
/* Python wrapper */
static int __pyx_pw_8pysndlib_3clm_7mus_any_13mus_frequency_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_v); /*proto*/
static int __pyx_pw_8pysndlib_3clm_7mus_any_13mus_frequency_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_v) {
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
int __pyx_r;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
__pyx_r = __pyx_pf_8pysndlib_3clm_7mus_any_13mus_frequency_2__set__(((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_v_self), ((PyObject *)__pyx_v_v));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static int __pyx_pf_8pysndlib_3clm_7mus_any_13mus_frequency_2__set__(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_self, PyObject *__pyx_v_v) {
int __pyx_r;
/* … */
/* function exit code */
__pyx_r = 0;
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_AddTraceback("pysndlib.clm.mus_any.mus_frequency.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = -1;
__pyx_L0:;
return __pyx_r;
}
0394: def mus_frequency(self, v):
+0395: cclm.mus_set_frequency(self._ptr, v)
__pyx_t_1 = __pyx_PyFloat_AsDouble(__pyx_v_v); if (unlikely((__pyx_t_1 == ((mus_float_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 395, __pyx_L1_error) (void)(mus_set_frequency(__pyx_v_self->_ptr, __pyx_t_1));
0396:
+0397: @property
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_7mus_any_9mus_phase_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8pysndlib_3clm_7mus_any_9mus_phase_1__get__(PyObject *__pyx_v_self) {
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
__pyx_r = __pyx_pf_8pysndlib_3clm_7mus_any_9mus_phase___get__(((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_7mus_any_9mus_phase___get__(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_self) {
PyObject *__pyx_r = NULL;
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("pysndlib.clm.mus_any.mus_phase.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
0398: def mus_phase(self):
0399: """
0400: phase (radians), float
0401: """
+0402: return cclm.mus_phase(self._ptr)
__Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyFloat_FromDouble(mus_phase(__pyx_v_self->_ptr)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 402, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
0403:
+0404: @mus_phase.setter
/* Python wrapper */
static int __pyx_pw_8pysndlib_3clm_7mus_any_9mus_phase_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_v); /*proto*/
static int __pyx_pw_8pysndlib_3clm_7mus_any_9mus_phase_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_v) {
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
int __pyx_r;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
__pyx_r = __pyx_pf_8pysndlib_3clm_7mus_any_9mus_phase_2__set__(((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_v_self), ((PyObject *)__pyx_v_v));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static int __pyx_pf_8pysndlib_3clm_7mus_any_9mus_phase_2__set__(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_self, PyObject *__pyx_v_v) {
int __pyx_r;
/* … */
/* function exit code */
__pyx_r = 0;
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_AddTraceback("pysndlib.clm.mus_any.mus_phase.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = -1;
__pyx_L0:;
return __pyx_r;
}
0405: def mus_phase(self, v):
+0406: cclm.mus_set_phase(self._ptr, v)
__pyx_t_1 = __pyx_PyFloat_AsDouble(__pyx_v_v); if (unlikely((__pyx_t_1 == ((mus_float_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 406, __pyx_L1_error) (void)(mus_set_phase(__pyx_v_self->_ptr, __pyx_t_1));
0407:
+0408: @property
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_7mus_any_10mus_length_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8pysndlib_3clm_7mus_any_10mus_length_1__get__(PyObject *__pyx_v_self) {
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
__pyx_r = __pyx_pf_8pysndlib_3clm_7mus_any_10mus_length___get__(((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_7mus_any_10mus_length___get__(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_self) {
PyObject *__pyx_r = NULL;
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("pysndlib.clm.mus_any.mus_length.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
0409: def mus_length(self):
0410: """
0411: data length, int
0412: """
+0413: return cclm.mus_length(self._ptr)
__Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyInt_From_int64_t(mus_length(__pyx_v_self->_ptr)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 413, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
0414:
+0415: @mus_length.setter
/* Python wrapper */
static int __pyx_pw_8pysndlib_3clm_7mus_any_10mus_length_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_v); /*proto*/
static int __pyx_pw_8pysndlib_3clm_7mus_any_10mus_length_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_v) {
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
int __pyx_r;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
__pyx_r = __pyx_pf_8pysndlib_3clm_7mus_any_10mus_length_2__set__(((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_v_self), ((PyObject *)__pyx_v_v));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static int __pyx_pf_8pysndlib_3clm_7mus_any_10mus_length_2__set__(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_self, PyObject *__pyx_v_v) {
int __pyx_r;
/* … */
/* function exit code */
__pyx_r = 0;
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_AddTraceback("pysndlib.clm.mus_any.mus_length.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = -1;
__pyx_L0:;
return __pyx_r;
}
0416: def mus_length(self, v):
+0417: cclm.mus_set_length(self._ptr, v)
__pyx_t_1 = __Pyx_PyInt_As_int64_t(__pyx_v_v); if (unlikely((__pyx_t_1 == ((mus_long_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 417, __pyx_L1_error) (void)(mus_set_length(__pyx_v_self->_ptr, __pyx_t_1));
0418:
+0419: @property
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_7mus_any_13mus_increment_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8pysndlib_3clm_7mus_any_13mus_increment_1__get__(PyObject *__pyx_v_self) {
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
__pyx_r = __pyx_pf_8pysndlib_3clm_7mus_any_13mus_increment___get__(((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_7mus_any_13mus_increment___get__(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_self) {
PyObject *__pyx_r = NULL;
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("pysndlib.clm.mus_any.mus_increment.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
0420: def mus_increment(self):
0421: """
0422: various increments, int
0423: """
+0424: return cclm.mus_increment(self._ptr)
__Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyFloat_FromDouble(mus_increment(__pyx_v_self->_ptr)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 424, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
0425:
+0426: @mus_increment.setter
/* Python wrapper */
static int __pyx_pw_8pysndlib_3clm_7mus_any_13mus_increment_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_v); /*proto*/
static int __pyx_pw_8pysndlib_3clm_7mus_any_13mus_increment_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_v) {
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
int __pyx_r;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
__pyx_r = __pyx_pf_8pysndlib_3clm_7mus_any_13mus_increment_2__set__(((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_v_self), ((PyObject *)__pyx_v_v));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static int __pyx_pf_8pysndlib_3clm_7mus_any_13mus_increment_2__set__(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_self, PyObject *__pyx_v_v) {
int __pyx_r;
/* … */
/* function exit code */
__pyx_r = 0;
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_AddTraceback("pysndlib.clm.mus_any.mus_increment.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = -1;
__pyx_L0:;
return __pyx_r;
}
0427: def mus_increment(self, v):
+0428: cclm.mus_set_increment(self._ptr, v)
__pyx_t_1 = __pyx_PyFloat_AsDouble(__pyx_v_v); if (unlikely((__pyx_t_1 == ((mus_float_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 428, __pyx_L1_error) (void)(mus_set_increment(__pyx_v_self->_ptr, __pyx_t_1));
0429:
+0430: @property
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_7mus_any_12mus_location_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8pysndlib_3clm_7mus_any_12mus_location_1__get__(PyObject *__pyx_v_self) {
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
__pyx_r = __pyx_pf_8pysndlib_3clm_7mus_any_12mus_location___get__(((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_7mus_any_12mus_location___get__(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_self) {
PyObject *__pyx_r = NULL;
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("pysndlib.clm.mus_any.mus_location.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
0431: def mus_location(self):
0432: """
0433: sample location for reads/write, int
0434: """
+0435: return cclm.mus_location(self._ptr)
__Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyInt_From_int64_t(mus_location(__pyx_v_self->_ptr)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 435, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
0436:
+0437: @mus_location.setter
/* Python wrapper */
static int __pyx_pw_8pysndlib_3clm_7mus_any_12mus_location_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_v); /*proto*/
static int __pyx_pw_8pysndlib_3clm_7mus_any_12mus_location_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_v) {
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
int __pyx_r;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
__pyx_r = __pyx_pf_8pysndlib_3clm_7mus_any_12mus_location_2__set__(((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_v_self), ((PyObject *)__pyx_v_v));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static int __pyx_pf_8pysndlib_3clm_7mus_any_12mus_location_2__set__(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_self, PyObject *__pyx_v_v) {
int __pyx_r;
/* … */
/* function exit code */
__pyx_r = 0;
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_AddTraceback("pysndlib.clm.mus_any.mus_location.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = -1;
__pyx_L0:;
return __pyx_r;
}
0438: def mus_location(self, v):
+0439: cclm.mus_set_location(self._ptr, v)
__pyx_t_1 = __Pyx_PyInt_As_int64_t(__pyx_v_v); if (unlikely((__pyx_t_1 == ((mus_long_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 439, __pyx_L1_error) (void)(mus_set_location(__pyx_v_self->_ptr, __pyx_t_1));
0440:
+0441: @property
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_7mus_any_10mus_offset_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8pysndlib_3clm_7mus_any_10mus_offset_1__get__(PyObject *__pyx_v_self) {
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
__pyx_r = __pyx_pf_8pysndlib_3clm_7mus_any_10mus_offset___get__(((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_7mus_any_10mus_offset___get__(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_self) {
PyObject *__pyx_r = NULL;
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("pysndlib.clm.mus_any.mus_offset.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
0442: def mus_offset(self):
+0443: return cclm.mus_offset(self._ptr)
__Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyFloat_FromDouble(mus_offset(__pyx_v_self->_ptr)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 443, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
0444:
+0445: @mus_offset.setter
/* Python wrapper */
static int __pyx_pw_8pysndlib_3clm_7mus_any_10mus_offset_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_v); /*proto*/
static int __pyx_pw_8pysndlib_3clm_7mus_any_10mus_offset_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_v) {
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
int __pyx_r;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
__pyx_r = __pyx_pf_8pysndlib_3clm_7mus_any_10mus_offset_2__set__(((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_v_self), ((PyObject *)__pyx_v_v));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static int __pyx_pf_8pysndlib_3clm_7mus_any_10mus_offset_2__set__(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_self, PyObject *__pyx_v_v) {
int __pyx_r;
/* … */
/* function exit code */
__pyx_r = 0;
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_AddTraceback("pysndlib.clm.mus_any.mus_offset.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = -1;
__pyx_L0:;
return __pyx_r;
}
0446: def mus_offset(self, v):
0447: """
0448: envelope offset, int
0449: """
+0450: cclm.mus_set_offset(self._ptr, v)
__pyx_t_1 = __pyx_PyFloat_AsDouble(__pyx_v_v); if (unlikely((__pyx_t_1 == ((mus_float_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 450, __pyx_L1_error) (void)(mus_set_offset(__pyx_v_self->_ptr, __pyx_t_1));
0451:
+0452: @property
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_7mus_any_12mus_channels_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8pysndlib_3clm_7mus_any_12mus_channels_1__get__(PyObject *__pyx_v_self) {
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
__pyx_r = __pyx_pf_8pysndlib_3clm_7mus_any_12mus_channels___get__(((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_7mus_any_12mus_channels___get__(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_self) {
PyObject *__pyx_r = NULL;
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("pysndlib.clm.mus_any.mus_channels.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
0453: def mus_channels(self):
0454: """
0455: channels open, int
0456: """
+0457: return cclm.mus_channels(self._ptr)
__Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyInt_From_int(mus_channels(__pyx_v_self->_ptr)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 457, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
0458:
0459:
+0460: @property
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_7mus_any_15mus_interp_type_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8pysndlib_3clm_7mus_any_15mus_interp_type_1__get__(PyObject *__pyx_v_self) {
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
__pyx_r = __pyx_pf_8pysndlib_3clm_7mus_any_15mus_interp_type___get__(((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_7mus_any_15mus_interp_type___get__(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_self) {
PyObject *__pyx_r = NULL;
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("pysndlib.clm.mus_any.mus_interp_type.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
0461: def mus_interp_type(self):
0462: """
0463: interpolation type (inter.linear, etc), interp
0464: not setable
0465: """
+0466: return cclm.mus_interp_type(self._ptr)
__Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyInt_From_int(mus_interp_type(__pyx_v_self->_ptr)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 466, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
0467:
+0468: @property
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_7mus_any_9mus_width_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8pysndlib_3clm_7mus_any_9mus_width_1__get__(PyObject *__pyx_v_self) {
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
__pyx_r = __pyx_pf_8pysndlib_3clm_7mus_any_9mus_width___get__(((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_7mus_any_9mus_width___get__(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_self) {
PyObject *__pyx_r = NULL;
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("pysndlib.clm.mus_any.mus_width.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
0469: def mus_width(self):
0470: """
0471: width of interpolation tables, etc, int
0472: """
+0473: return cclm.mus_width(self._ptr)
__Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyFloat_FromDouble(mus_width(__pyx_v_self->_ptr)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 473, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
0474:
+0475: @mus_width.setter
/* Python wrapper */
static int __pyx_pw_8pysndlib_3clm_7mus_any_9mus_width_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_v); /*proto*/
static int __pyx_pw_8pysndlib_3clm_7mus_any_9mus_width_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_v) {
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
int __pyx_r;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
__pyx_r = __pyx_pf_8pysndlib_3clm_7mus_any_9mus_width_2__set__(((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_v_self), ((PyObject *)__pyx_v_v));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static int __pyx_pf_8pysndlib_3clm_7mus_any_9mus_width_2__set__(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_self, PyObject *__pyx_v_v) {
int __pyx_r;
/* … */
/* function exit code */
__pyx_r = 0;
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_AddTraceback("pysndlib.clm.mus_any.mus_width.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = -1;
__pyx_L0:;
return __pyx_r;
}
0476: def mus_width(self, v):
+0477: cclm.mus_set_width(self._ptr, v)
__pyx_t_1 = __pyx_PyFloat_AsDouble(__pyx_v_v); if (unlikely((__pyx_t_1 == ((mus_float_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 477, __pyx_L1_error) (void)(mus_set_width(__pyx_v_self->_ptr, __pyx_t_1));
0478:
+0479: @property
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_7mus_any_9mus_order_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8pysndlib_3clm_7mus_any_9mus_order_1__get__(PyObject *__pyx_v_self) {
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
__pyx_r = __pyx_pf_8pysndlib_3clm_7mus_any_9mus_order___get__(((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_7mus_any_9mus_order___get__(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_self) {
PyObject *__pyx_r = NULL;
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("pysndlib.clm.mus_any.mus_order.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
0480: def mus_order(self):
0481: """
0482: filter order, int
0483: """
+0484: return cclm.mus_order(self._ptr)
__Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyInt_From_int64_t(mus_order(__pyx_v_self->_ptr)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 484, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
0485:
+0486: @property
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_7mus_any_10mus_scaler_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8pysndlib_3clm_7mus_any_10mus_scaler_1__get__(PyObject *__pyx_v_self) {
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
__pyx_r = __pyx_pf_8pysndlib_3clm_7mus_any_10mus_scaler___get__(((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_7mus_any_10mus_scaler___get__(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_self) {
PyObject *__pyx_r = NULL;
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("pysndlib.clm.mus_any.mus_scaler.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
0487: def mus_scaler(self):
0488: """
0489: scaler, normally on an amplitude, float
0490: """
+0491: return cclm.mus_scaler(self._ptr)
__Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyFloat_FromDouble(mus_scaler(__pyx_v_self->_ptr)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 491, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
0492:
+0493: @mus_scaler.setter
/* Python wrapper */
static int __pyx_pw_8pysndlib_3clm_7mus_any_10mus_scaler_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_v); /*proto*/
static int __pyx_pw_8pysndlib_3clm_7mus_any_10mus_scaler_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_v) {
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
int __pyx_r;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
__pyx_r = __pyx_pf_8pysndlib_3clm_7mus_any_10mus_scaler_2__set__(((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_v_self), ((PyObject *)__pyx_v_v));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static int __pyx_pf_8pysndlib_3clm_7mus_any_10mus_scaler_2__set__(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_self, PyObject *__pyx_v_v) {
int __pyx_r;
/* … */
/* function exit code */
__pyx_r = 0;
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_AddTraceback("pysndlib.clm.mus_any.mus_scaler.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = -1;
__pyx_L0:;
return __pyx_r;
}
0494: def mus_scaler(self, v):
+0495: cclm.mus_set_scaler(self._ptr, v)
__pyx_t_1 = __pyx_PyFloat_AsDouble(__pyx_v_v); if (unlikely((__pyx_t_1 == ((mus_float_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 495, __pyx_L1_error) (void)(mus_set_scaler(__pyx_v_self->_ptr, __pyx_t_1));
0496:
+0497: @property
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_7mus_any_12mus_feedback_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8pysndlib_3clm_7mus_any_12mus_feedback_1__get__(PyObject *__pyx_v_self) {
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
__pyx_r = __pyx_pf_8pysndlib_3clm_7mus_any_12mus_feedback___get__(((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_7mus_any_12mus_feedback___get__(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_self) {
PyObject *__pyx_r = NULL;
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("pysndlib.clm.mus_any.mus_feedback.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
0498: def mus_feedback(self):
0499: """
0500: feedback coefficient, float
0501: """
+0502: return cclm.mus_feedback(self._ptr)
__Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyFloat_FromDouble(mus_feedback(__pyx_v_self->_ptr)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 502, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
0503:
+0504: @mus_feedback.setter
/* Python wrapper */
static int __pyx_pw_8pysndlib_3clm_7mus_any_12mus_feedback_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_v); /*proto*/
static int __pyx_pw_8pysndlib_3clm_7mus_any_12mus_feedback_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_v) {
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
int __pyx_r;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
__pyx_r = __pyx_pf_8pysndlib_3clm_7mus_any_12mus_feedback_2__set__(((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_v_self), ((PyObject *)__pyx_v_v));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static int __pyx_pf_8pysndlib_3clm_7mus_any_12mus_feedback_2__set__(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_self, PyObject *__pyx_v_v) {
int __pyx_r;
/* … */
/* function exit code */
__pyx_r = 0;
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_AddTraceback("pysndlib.clm.mus_any.mus_feedback.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = -1;
__pyx_L0:;
return __pyx_r;
}
0505: def mus_feedback(self, v):
+0506: cclm.mus_set_feedback(self._ptr, v)
__pyx_t_1 = __pyx_PyFloat_AsDouble(__pyx_v_v); if (unlikely((__pyx_t_1 == ((mus_float_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 506, __pyx_L1_error) (void)(mus_set_feedback(__pyx_v_self->_ptr, __pyx_t_1));
0507:
+0508: @property
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_7mus_any_15mus_feedforward_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8pysndlib_3clm_7mus_any_15mus_feedforward_1__get__(PyObject *__pyx_v_self) {
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
__pyx_r = __pyx_pf_8pysndlib_3clm_7mus_any_15mus_feedforward___get__(((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_7mus_any_15mus_feedforward___get__(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_self) {
PyObject *__pyx_r = NULL;
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("pysndlib.clm.mus_any.mus_feedforward.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
0509: def mus_feedforward(self):
0510: """
0511: feedforward coefficient, float
0512: """
+0513: return cclm.mus_feedforward(self._ptr)
__Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyFloat_FromDouble(mus_feedforward(__pyx_v_self->_ptr)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 513, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
0514:
+0515: @mus_feedforward.setter
/* Python wrapper */
static int __pyx_pw_8pysndlib_3clm_7mus_any_15mus_feedforward_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_v); /*proto*/
static int __pyx_pw_8pysndlib_3clm_7mus_any_15mus_feedforward_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_v) {
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
int __pyx_r;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
__pyx_r = __pyx_pf_8pysndlib_3clm_7mus_any_15mus_feedforward_2__set__(((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_v_self), ((PyObject *)__pyx_v_v));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static int __pyx_pf_8pysndlib_3clm_7mus_any_15mus_feedforward_2__set__(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_self, PyObject *__pyx_v_v) {
int __pyx_r;
/* … */
/* function exit code */
__pyx_r = 0;
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_AddTraceback("pysndlib.clm.mus_any.mus_feedforward.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = -1;
__pyx_L0:;
return __pyx_r;
}
0516: def mus_feedforward(self, v):
+0517: cclm.mus_set_feedforward(self._ptr, v)
__pyx_t_1 = __pyx_PyFloat_AsDouble(__pyx_v_v); if (unlikely((__pyx_t_1 == ((mus_float_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 517, __pyx_L1_error) (void)(mus_set_feedforward(__pyx_v_self->_ptr, __pyx_t_1));
0518:
+0519: @property
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_7mus_any_7mus_hop_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8pysndlib_3clm_7mus_any_7mus_hop_1__get__(PyObject *__pyx_v_self) {
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
__pyx_r = __pyx_pf_8pysndlib_3clm_7mus_any_7mus_hop___get__(((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_7mus_any_7mus_hop___get__(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_self) {
PyObject *__pyx_r = NULL;
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("pysndlib.clm.mus_any.mus_hop.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
0520: def mus_hop(self):
0521: """
0522: hop size for block processing, int
0523: """
+0524: return cclm.mus_hop(self._ptr)
__Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyInt_From_int64_t(mus_hop(__pyx_v_self->_ptr)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 524, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
0525:
+0526: @mus_hop.setter
/* Python wrapper */
static int __pyx_pw_8pysndlib_3clm_7mus_any_7mus_hop_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_v); /*proto*/
static int __pyx_pw_8pysndlib_3clm_7mus_any_7mus_hop_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_v) {
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
int __pyx_r;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
__pyx_r = __pyx_pf_8pysndlib_3clm_7mus_any_7mus_hop_2__set__(((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_v_self), ((PyObject *)__pyx_v_v));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static int __pyx_pf_8pysndlib_3clm_7mus_any_7mus_hop_2__set__(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_self, PyObject *__pyx_v_v) {
int __pyx_r;
/* … */
/* function exit code */
__pyx_r = 0;
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_AddTraceback("pysndlib.clm.mus_any.mus_hop.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = -1;
__pyx_L0:;
return __pyx_r;
}
0527: def mus_hop(self, v):
+0528: cclm.mus_set_hop(self._ptr, v)
__pyx_t_1 = __Pyx_PyInt_As_int64_t(__pyx_v_v); if (unlikely((__pyx_t_1 == ((mus_long_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 528, __pyx_L1_error) (void)(mus_set_hop(__pyx_v_self->_ptr, __pyx_t_1));
0529:
+0530: @property
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_7mus_any_8mus_ramp_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8pysndlib_3clm_7mus_any_8mus_ramp_1__get__(PyObject *__pyx_v_self) {
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
__pyx_r = __pyx_pf_8pysndlib_3clm_7mus_any_8mus_ramp___get__(((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_7mus_any_8mus_ramp___get__(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_self) {
PyObject *__pyx_r = NULL;
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("pysndlib.clm.mus_any.mus_ramp.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
0531: def mus_ramp(self):
0532: """
0533: granulate grain envelope ramp setting, int
0534: """
+0535: return cclm.mus_ramp(self._ptr)
__Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyInt_From_int64_t(mus_ramp(__pyx_v_self->_ptr)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 535, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
0536:
+0537: @mus_ramp.setter
/* Python wrapper */
static int __pyx_pw_8pysndlib_3clm_7mus_any_8mus_ramp_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_v); /*proto*/
static int __pyx_pw_8pysndlib_3clm_7mus_any_8mus_ramp_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_v) {
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
int __pyx_r;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
__pyx_r = __pyx_pf_8pysndlib_3clm_7mus_any_8mus_ramp_2__set__(((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_v_self), ((PyObject *)__pyx_v_v));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static int __pyx_pf_8pysndlib_3clm_7mus_any_8mus_ramp_2__set__(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_self, PyObject *__pyx_v_v) {
int __pyx_r;
/* … */
/* function exit code */
__pyx_r = 0;
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_AddTraceback("pysndlib.clm.mus_any.mus_ramp.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = -1;
__pyx_L0:;
return __pyx_r;
}
0538: def mus_ramp(self, v):
+0539: cclm.mus_set_ramp(self._ptr, v)
__pyx_t_1 = __Pyx_PyInt_As_int64_t(__pyx_v_v); if (unlikely((__pyx_t_1 == ((mus_long_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 539, __pyx_L1_error) (void)(mus_set_ramp(__pyx_v_self->_ptr, __pyx_t_1));
0540:
+0541: @property
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_7mus_any_11mus_channel_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8pysndlib_3clm_7mus_any_11mus_channel_1__get__(PyObject *__pyx_v_self) {
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
__pyx_r = __pyx_pf_8pysndlib_3clm_7mus_any_11mus_channel___get__(((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_7mus_any_11mus_channel___get__(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_self) {
PyObject *__pyx_r = NULL;
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("pysndlib.clm.mus_any.mus_channel.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
0542: def mus_channel(self):
0543: """
0544: channel being read/written, int
0545: """
+0546: return cclm.mus_channel(self._ptr)
__Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyInt_From_int(mus_channel(__pyx_v_self->_ptr)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 546, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
0547:
+0548: @property
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_7mus_any_8mus_data_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8pysndlib_3clm_7mus_any_8mus_data_1__get__(PyObject *__pyx_v_self) {
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
__pyx_r = __pyx_pf_8pysndlib_3clm_7mus_any_8mus_data___get__(((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_7mus_any_8mus_data___get__(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_self) {
PyObject *__pyx_r = NULL;
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_AddTraceback("pysndlib.clm.mus_any.mus_data.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
0549: def mus_data(self):
0550: """
0551: array of data, np.ndarray
0552: """
+0553: if not cclm.mus_data_exists(self._ptr): #could do this on all properties but seems best with array
__pyx_t_1 = (!mus_data_exists(__pyx_v_self->_ptr));
if (unlikely(__pyx_t_1)) {
/* … */
}
+0554: raise TypeError(f'mus_data can not be called on {cclm.mus_name(self._ptr)}')
__pyx_t_2 = __Pyx_PyUnicode_FromString(mus_name(__pyx_v_self->_ptr)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 554, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyUnicode_Concat(__pyx_kp_u_mus_data_can_not_be_called_on, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 554, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 554, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __PYX_ERR(0, 554, __pyx_L1_error)
+0555: return self._data
__Pyx_XDECREF(__pyx_r); __Pyx_INCREF((PyObject *)__pyx_v_self->_data); __pyx_r = ((PyObject *)__pyx_v_self->_data); goto __pyx_L0;
0556:
+0557: @mus_data.setter
/* Python wrapper */
static int __pyx_pw_8pysndlib_3clm_7mus_any_8mus_data_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_data); /*proto*/
static int __pyx_pw_8pysndlib_3clm_7mus_any_8mus_data_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_data) {
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
int __pyx_r;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
__pyx_r = __pyx_pf_8pysndlib_3clm_7mus_any_8mus_data_2__set__(((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_v_self), ((PyObject *)__pyx_v_data));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static int __pyx_pf_8pysndlib_3clm_7mus_any_8mus_data_2__set__(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_self, PyObject *__pyx_v_data) {
int __pyx_r;
/* … */
/* function exit code */
__pyx_r = 0;
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_AddTraceback("pysndlib.clm.mus_any.mus_data.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = -1;
__pyx_L0:;
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
0558: def mus_data(self, data: npt.NDArray[np.float64]):
+0559: if not cclm.mus_data_exists(self._ptr): #could do this on all properties but seems best with array
__pyx_t_1 = (!mus_data_exists(__pyx_v_self->_ptr));
if (unlikely(__pyx_t_1)) {
/* … */
}
+0560: raise TypeError(f'mus_data can not be called on {cclm.mus_name(self._ptr)}')
__pyx_t_2 = __Pyx_PyUnicode_FromString(mus_name(__pyx_v_self->_ptr)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 560, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyUnicode_Concat(__pyx_kp_u_mus_data_can_not_be_called_on, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 560, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 560, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __PYX_ERR(0, 560, __pyx_L1_error)
0561:
+0562: np.copyto(self._data , data)
__Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 562, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_copyto); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 562, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = NULL; __pyx_t_5 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_4))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_4, function); __pyx_t_5 = 1; } } #endif { PyObject *__pyx_callargs[3] = {__pyx_t_3, ((PyObject *)__pyx_v_self->_data), __pyx_v_data}; __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_5, 2+__pyx_t_5); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 562, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
0563:
+0564: @property
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_7mus_any_11mus_xcoeffs_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8pysndlib_3clm_7mus_any_11mus_xcoeffs_1__get__(PyObject *__pyx_v_self) {
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
__pyx_r = __pyx_pf_8pysndlib_3clm_7mus_any_11mus_xcoeffs___get__(((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_7mus_any_11mus_xcoeffs___get__(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_self) {
PyObject *__pyx_r = NULL;
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_AddTraceback("pysndlib.clm.mus_any.mus_xcoeffs.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
0565: def mus_xcoeffs(self):
0566: """
0567: x (input) coefficient, np.ndarray
0568: not setable
0569: """
+0570: if not cclm.mus_xcoeffs_exists(self._ptr): #could do this on all properties but seems best with array
__pyx_t_1 = (!mus_xcoeffs_exists(__pyx_v_self->_ptr));
if (unlikely(__pyx_t_1)) {
/* … */
}
+0571: raise TypeError(f'mus_xcoeffs can not be called on {cclm.mus_name(self._ptr)}')
__pyx_t_2 = __Pyx_PyUnicode_FromString(mus_name(__pyx_v_self->_ptr)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 571, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyUnicode_Concat(__pyx_kp_u_mus_xcoeffs_can_not_be_called_on, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 571, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 571, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __PYX_ERR(0, 571, __pyx_L1_error)
+0572: return self._xcoeffs
__Pyx_XDECREF(__pyx_r); __Pyx_INCREF((PyObject *)__pyx_v_self->_xcoeffs); __pyx_r = ((PyObject *)__pyx_v_self->_xcoeffs); goto __pyx_L0;
0573:
+0574: @property
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_7mus_any_11mus_ycoeffs_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8pysndlib_3clm_7mus_any_11mus_ycoeffs_1__get__(PyObject *__pyx_v_self) {
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
__pyx_r = __pyx_pf_8pysndlib_3clm_7mus_any_11mus_ycoeffs___get__(((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_7mus_any_11mus_ycoeffs___get__(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_self) {
PyObject *__pyx_r = NULL;
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_AddTraceback("pysndlib.clm.mus_any.mus_ycoeffs.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
0575: def mus_ycoeffs(self):
0576: """
0577: y (output, feedback) coefficient, np.ndarray
0578: not setable
0579: """
+0580: if not cclm.mus_ycoeffs_exists(self._ptr): #could do this on all properties but seems best with array
__pyx_t_1 = (!mus_ycoeffs_exists(__pyx_v_self->_ptr));
if (unlikely(__pyx_t_1)) {
/* … */
}
+0581: raise TypeError(f'mus_ycoeffs can not be called on {cclm.mus_name(self._ptr)}')
__pyx_t_2 = __Pyx_PyUnicode_FromString(mus_name(__pyx_v_self->_ptr)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 581, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyUnicode_Concat(__pyx_kp_u_mus_ycoeffs_can_not_be_called_on, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 581, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 581, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __PYX_ERR(0, 581, __pyx_L1_error)
+0582: return self._ycoeffs
__Pyx_XDECREF(__pyx_r); __Pyx_INCREF((PyObject *)__pyx_v_self->_ycoeffs); __pyx_r = ((PyObject *)__pyx_v_self->_ycoeffs); goto __pyx_L0;
0583:
0584:
0585:
+0586: cdef class mus_any_array:
struct __pyx_obj_8pysndlib_3clm_mus_any_array {
PyObject_HEAD
struct __pyx_vtabstruct_8pysndlib_3clm_mus_any_array *__pyx_vtab;
mus_any_ptr_ptr data;
size_t item_count;
};
/* … */
struct __pyx_vtabstruct_8pysndlib_3clm_mus_any_array {
struct __pyx_obj_8pysndlib_3clm_mus_any_array *(*from_pylist)(PyObject *);
};
static struct __pyx_vtabstruct_8pysndlib_3clm_mus_any_array *__pyx_vtabptr_8pysndlib_3clm_mus_any_array;
0587: """
0588: a wrapper class arrays of mus_any objects
0589: :meta private:
0590: """
0591: cdef cclm.mus_any_ptr_ptr data
0592: item_count: cython.size_t
+0593: def __cinit__(self, number: cython.size_t):
/* Python wrapper */
static int __pyx_pw_8pysndlib_3clm_13mus_any_array_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_8pysndlib_3clm_13mus_any_array_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
size_t __pyx_v_number;
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
int __pyx_r;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
#endif
__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_number,0};
PyObject* values[1] = {0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_VARARGS(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_number)) != 0)) {
(void)__Pyx_Arg_NewRef_VARARGS(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 593, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__cinit__") < 0)) __PYX_ERR(0, 593, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 1)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
}
__pyx_v_number = __Pyx_PyInt_As_size_t(values[0]); if (unlikely((__pyx_v_number == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 593, __pyx_L3_error)
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 593, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.mus_any_array.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return -1;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_8pysndlib_3clm_13mus_any_array___cinit__(((struct __pyx_obj_8pysndlib_3clm_mus_any_array *)__pyx_v_self), __pyx_v_number);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static int __pyx_pf_8pysndlib_3clm_13mus_any_array___cinit__(struct __pyx_obj_8pysndlib_3clm_mus_any_array *__pyx_v_self, size_t __pyx_v_number) {
int __pyx_r;
/* … */
/* function exit code */
__pyx_r = 0;
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_AddTraceback("pysndlib.clm.mus_any_array.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = -1;
__pyx_L0:;
return __pyx_r;
}
0594: # allocate some memory (uninitialised, may contain arbitrary data)
+0595: if number > 0:
__pyx_t_1 = (__pyx_v_number > 0);
if (__pyx_t_1) {
/* … */
}
+0596: self.data = cython.cast(cclm.mus_any_ptr_ptr, PyMem_Malloc(
__pyx_v_self->data = ((mus_any_ptr_ptr)PyMem_Malloc((__pyx_v_number * (sizeof(mus_any_ptr)))));
0597: number * cython.sizeof(cclm.mus_any_ptr)))
+0598: if not self.data:
__pyx_t_1 = (!(__pyx_v_self->data != 0));
if (unlikely(__pyx_t_1)) {
/* … */
}
+0599: raise MemoryError()
PyErr_NoMemory(); __PYX_ERR(0, 599, __pyx_L1_error)
+0600: self.item_count = number
__pyx_v_self->item_count = __pyx_v_number;
0601:
0602:
+0603: def __dealloc__(self):
/* Python wrapper */
static void __pyx_pw_8pysndlib_3clm_13mus_any_array_3__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_8pysndlib_3clm_13mus_any_array_3__dealloc__(PyObject *__pyx_v_self) {
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
__pyx_pf_8pysndlib_3clm_13mus_any_array_2__dealloc__(((struct __pyx_obj_8pysndlib_3clm_mus_any_array *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
}
static void __pyx_pf_8pysndlib_3clm_13mus_any_array_2__dealloc__(struct __pyx_obj_8pysndlib_3clm_mus_any_array *__pyx_v_self) {
/* … */
/* function exit code */
}
+0604: PyMem_Free(self.data) # no-op if self.data is null
PyMem_Free(__pyx_v_self->data);
0605:
+0606: def __len__(self):
/* Python wrapper */
static Py_ssize_t __pyx_pw_8pysndlib_3clm_13mus_any_array_5__len__(PyObject *__pyx_v_self); /*proto*/
static Py_ssize_t __pyx_pw_8pysndlib_3clm_13mus_any_array_5__len__(PyObject *__pyx_v_self) {
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
Py_ssize_t __pyx_r;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
__pyx_r = __pyx_pf_8pysndlib_3clm_13mus_any_array_4__len__(((struct __pyx_obj_8pysndlib_3clm_mus_any_array *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static Py_ssize_t __pyx_pf_8pysndlib_3clm_13mus_any_array_4__len__(struct __pyx_obj_8pysndlib_3clm_mus_any_array *__pyx_v_self) {
Py_ssize_t __pyx_r;
/* … */
/* function exit code */
__pyx_L0:;
return __pyx_r;
}
+0607: return self.item_count
__pyx_r = __pyx_v_self->item_count; goto __pyx_L0;
0608:
+0609: def __str__(self):
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_13mus_any_array_7__str__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8pysndlib_3clm_13mus_any_array_7__str__(PyObject *__pyx_v_self) {
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__str__ (wrapper)", 0);
__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
__pyx_r = __pyx_pf_8pysndlib_3clm_13mus_any_array_6__str__(((struct __pyx_obj_8pysndlib_3clm_mus_any_array *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_13mus_any_array_6__str__(struct __pyx_obj_8pysndlib_3clm_mus_any_array *__pyx_v_self) {
PyObject *__pyx_r = NULL;
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("pysndlib.clm.mus_any_array.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
+0610: return f"count {self.item_count}"
__Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyUnicode_From_size_t(__pyx_v_self->item_count, 0, ' ', 'd'); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 610, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyUnicode_Concat(__pyx_kp_u_count, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 610, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0;
0611:
0612: @staticmethod
+0613: cdef mus_any_array from_pylist(lst: list):
static struct __pyx_obj_8pysndlib_3clm_mus_any_array *__pyx_f_8pysndlib_3clm_13mus_any_array_from_pylist(PyObject *__pyx_v_lst) {
int __pyx_v_i;
struct __pyx_obj_8pysndlib_3clm_mus_any_array *__pyx_v_wrapper = 0;
struct __pyx_obj_8pysndlib_3clm_mus_any_array *__pyx_r = NULL;
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_AddTraceback("pysndlib.clm.mus_any_array.from_pylist", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XDECREF((PyObject *)__pyx_v_wrapper);
__Pyx_XGIVEREF((PyObject *)__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
0614: """
0615: factory function to create a wrapper around mus_float_t (double) and fill it with values from the list
0616: """
0617: cdef int i
0618:
+0619: cdef mus_any_array wrapper = mus_any_array(len(lst))
__pyx_t_1 = __Pyx_PyList_GET_SIZE(__pyx_v_lst); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 619, __pyx_L1_error) __pyx_t_2 = PyInt_FromSsize_t(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 619, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_8pysndlib_3clm_mus_any_array), __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 619, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v_wrapper = ((struct __pyx_obj_8pysndlib_3clm_mus_any_array *)__pyx_t_3); __pyx_t_3 = 0;
+0620: for i in range(len(lst)):
__pyx_t_1 = __Pyx_PyList_GET_SIZE(__pyx_v_lst); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 620, __pyx_L1_error) __pyx_t_4 = __pyx_t_1; for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { __pyx_v_i = __pyx_t_5;
+0621: wrapper.data[i] = (<mus_any>lst[i])._ptr
__pyx_t_3 = __Pyx_GetItemInt_List(__pyx_v_lst, __pyx_v_i, int, 1, __Pyx_PyInt_From_int, 1, 1, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 621, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_6 = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_t_3)->_ptr; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; (__pyx_v_wrapper->data[__pyx_v_i]) = __pyx_t_6; }
+0622: return wrapper
__Pyx_XDECREF((PyObject *)__pyx_r); __Pyx_INCREF((PyObject *)__pyx_v_wrapper); __pyx_r = __pyx_v_wrapper; goto __pyx_L0;
0623:
0624:
0625:
0626:
0627: # --------------- callbacks ---------------- #
0628:
+0629: cdef double input_callback_func(void* arg, int direction):
static double __pyx_f_8pysndlib_3clm_input_callback_func(void *__pyx_v_arg, int __pyx_v_direction) {
mus_any_ptr __pyx_v_gen;
double __pyx_r;
/* … */
/* function exit code */
__pyx_L0:;
return __pyx_r;
}
+0630: cdef cclm.mus_any_ptr gen = <cclm.mus_any_ptr>arg
__pyx_v_gen = ((mus_any_ptr)__pyx_v_arg);
+0631: return cclm.mus_apply(gen, direction, 0.)
__pyx_r = mus_apply(__pyx_v_gen, __pyx_v_direction, 0.); goto __pyx_L0;
0632:
0633:
+0634: cdef void locsig_detour_callback_func(cclm.mus_any *ptr, cclm.mus_long_t val):
static void __pyx_f_8pysndlib_3clm_locsig_detour_callback_func(mus_any *__pyx_v_ptr, mus_long_t __pyx_v_val) {
int __pyx_v_channels;
int __pyx_v_reverb_channels;
mus_float_t *__pyx_v_outf;
mus_float_t *__pyx_v_revf;
int __pyx_v_i;
/* … */
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_4);
__Pyx_XDECREF(__pyx_t_5);
__Pyx_XDECREF(__pyx_t_7);
__Pyx_XDECREF(__pyx_t_8);
__Pyx_AddTraceback("pysndlib.clm.locsig_detour_callback_func", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_L0:;
__Pyx_RefNannyFinishContext();
}
+0635: cdef int channels = cclm.mus_locsig_channels(ptr)
__pyx_v_channels = mus_locsig_channels(__pyx_v_ptr);
+0636: cdef int reverb_channels = cclm.mus_locsig_reverb_channels(ptr)
__pyx_v_reverb_channels = mus_locsig_reverb_channels(__pyx_v_ptr);
+0637: cdef cclm.mus_float_t* outf = cclm.mus_locsig_outf(ptr)
__pyx_v_outf = mus_locsig_outf(__pyx_v_ptr);
+0638: cdef cclm.mus_float_t* revf = cclm.mus_locsig_revf(ptr)
__pyx_v_revf = mus_locsig_revf(__pyx_v_ptr);
+0639: for i in range(channels):
__pyx_t_1 = __pyx_v_channels;
__pyx_t_2 = __pyx_t_1;
for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
__pyx_v_i = __pyx_t_3;
+0640: CLM.output[i][val] += outf[i]
__Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_CLM); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 640, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_output); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 640, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_5, __pyx_v_i, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 640, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_6 = __pyx_v_val; __pyx_t_5 = __Pyx_GetItemInt(__pyx_t_4, __pyx_t_6, mus_long_t, 1, __Pyx_PyInt_From_int64_t, 0, 1, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 640, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_7 = PyFloat_FromDouble((__pyx_v_outf[__pyx_v_i])); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 640, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_8 = PyNumber_InPlaceAdd(__pyx_t_5, __pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 640, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; if (unlikely((__Pyx_SetItemInt(__pyx_t_4, __pyx_t_6, __pyx_t_8, mus_long_t, 1, __Pyx_PyInt_From_int64_t, 0, 1, 1) < 0))) __PYX_ERR(0, 640, __pyx_L1_error) __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; }
+0641: for i in range(reverb_channels):
__pyx_t_1 = __pyx_v_reverb_channels;
__pyx_t_2 = __pyx_t_1;
for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
__pyx_v_i = __pyx_t_3;
+0642: CLM.reverb[i][val] += revf[i]
__Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_CLM); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 642, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_reverb); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 642, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_8, __pyx_v_i, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 642, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __pyx_t_6 = __pyx_v_val; __pyx_t_8 = __Pyx_GetItemInt(__pyx_t_4, __pyx_t_6, mus_long_t, 1, __Pyx_PyInt_From_int64_t, 0, 1, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 642, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __pyx_t_7 = PyFloat_FromDouble((__pyx_v_revf[__pyx_v_i])); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 642, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_5 = PyNumber_InPlaceAdd(__pyx_t_8, __pyx_t_7); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 642, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; if (unlikely((__Pyx_SetItemInt(__pyx_t_4, __pyx_t_6, __pyx_t_5, mus_long_t, 1, __Pyx_PyInt_From_int64_t, 0, 1, 1) < 0))) __PYX_ERR(0, 642, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; }
0643:
0644:
0645: # --------------- file2ndarray, ndarray2file ---------------- #
+0646: def file2ndarray(filename: str, channel: int=None, beg: int =None, dur: int=None):
/* Python wrapper */ static PyObject *__pyx_pw_8pysndlib_3clm_7file2ndarray(PyObject *__pyx_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_6file2ndarray, "\n return an ndarray with samples from file and the sample rate of the data\n \n :param filename: filename\n :param channel: if None, will read all channels, otherwise just channel specified \n :param beg: beginning positions to read in samples\n :param dur: duration in samples to read\n :return: tuple of np.ndarray and sample rate\n :rtype: tuple\n \n "); static PyMethodDef __pyx_mdef_8pysndlib_3clm_7file2ndarray = {"file2ndarray", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_7file2ndarray, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_6file2ndarray}; static PyObject *__pyx_pw_8pysndlib_3clm_7file2ndarray(PyObject *__pyx_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { PyObject *__pyx_v_filename = 0; PyObject *__pyx_v_channel = 0; PyObject *__pyx_v_beg = 0; PyObject *__pyx_v_dur = 0; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("file2ndarray (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_MACROS __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { PyObject **__pyx_pyargnames[] = {&__pyx_n_s_filename,&__pyx_n_s_channel,&__pyx_n_s_beg,&__pyx_n_s_dur,0}; PyObject* values[4] = {0,0,0,0}; values[1] = __Pyx_Arg_NewRef_FASTCALL(((PyObject*)Py_None)); values[2] = __Pyx_Arg_NewRef_FASTCALL(((PyObject*)Py_None)); values[3] = __Pyx_Arg_NewRef_FASTCALL(((PyObject*)Py_None)); if (__pyx_kwds) { Py_ssize_t kw_args; switch (__pyx_nargs) { case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); CYTHON_FALLTHROUGH; case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); CYTHON_FALLTHROUGH; case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); CYTHON_FALLTHROUGH; case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); switch (__pyx_nargs) { case 0: if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_filename)) != 0)) { (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); kw_args--; } else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 646, __pyx_L3_error) else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: if (kw_args > 0) { PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_channel); if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 646, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: if (kw_args > 0) { PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_beg); if (value) { values[2] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 646, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 3: if (kw_args > 0) { PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_dur); if (value) { values[3] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 646, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { const Py_ssize_t kwd_pos_args = __pyx_nargs; if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "file2ndarray") < 0)) __PYX_ERR(0, 646, __pyx_L3_error) } } else { switch (__pyx_nargs) { case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); CYTHON_FALLTHROUGH; case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); CYTHON_FALLTHROUGH; case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); CYTHON_FALLTHROUGH; case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); break; default: goto __pyx_L5_argtuple_error; } } __pyx_v_filename = ((PyObject*)values[0]); __pyx_v_channel = ((PyObject*)values[1]); __pyx_v_beg = ((PyObject*)values[2]); __pyx_v_dur = ((PyObject*)values[3]); } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("file2ndarray", 0, 1, 4, __pyx_nargs); __PYX_ERR(0, 646, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; { Py_ssize_t __pyx_temp; for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); } } __Pyx_AddTraceback("pysndlib.clm.file2ndarray", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_filename), (&PyString_Type), 0, "filename", 1))) __PYX_ERR(0, 646, __pyx_L1_error) if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_channel), (&PyInt_Type), 1, "channel", 1))) __PYX_ERR(0, 646, __pyx_L1_error) if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_beg), (&PyInt_Type), 1, "beg", 1))) __PYX_ERR(0, 646, __pyx_L1_error) if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dur), (&PyInt_Type), 1, "dur", 1))) __PYX_ERR(0, 646, __pyx_L1_error) __pyx_r = __pyx_pf_8pysndlib_3clm_6file2ndarray(__pyx_self, __pyx_v_filename, __pyx_v_channel, __pyx_v_beg, __pyx_v_dur); /* function exit code */ goto __pyx_L0; __pyx_L1_error:; __pyx_r = NULL; __pyx_L0:; { Py_ssize_t __pyx_temp; for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); } } __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_8pysndlib_3clm_6file2ndarray(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_filename, PyObject *__pyx_v_channel, PyObject *__pyx_v_beg, PyObject *__pyx_v_dur) { PyObject *__pyx_v_length = NULL; int __pyx_v_chans; int __pyx_v_srate; PyObject *__pyx_v_bg = NULL; PyObject *__pyx_v_out = NULL; __Pyx_memviewslice __pyx_v_arr_view = { 0, 0, { 0 }, { 0 }, { 0 } }; int __pyx_v_i; PyObject *__pyx_r = NULL; /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_13); __Pyx_XDECREF(__pyx_t_14); __PYX_XCLEAR_MEMVIEW(&__pyx_t_15, 1); __Pyx_AddTraceback("pysndlib.clm.file2ndarray", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_length); __Pyx_XDECREF(__pyx_v_bg); __Pyx_XDECREF(__pyx_v_out); __PYX_XCLEAR_MEMVIEW(&__pyx_v_arr_view, 1); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__138 = PyTuple_Pack(11, __pyx_n_s_filename, __pyx_n_s_channel, __pyx_n_s_beg, __pyx_n_s_dur, __pyx_n_s_length, __pyx_n_s_chans, __pyx_n_s_srate, __pyx_n_s_bg, __pyx_n_s_out, __pyx_n_s_arr_view, __pyx_n_s_i); if (unlikely(!__pyx_tuple__138)) __PYX_ERR(0, 646, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__138); __Pyx_GIVEREF(__pyx_tuple__138); /* … */ __pyx_t_43 = __Pyx_PyDict_NewPresized(4); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 646, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_43); if (PyDict_SetItem(__pyx_t_43, __pyx_n_s_filename, __pyx_n_s_str_2) < 0) __PYX_ERR(0, 646, __pyx_L1_error) if (PyDict_SetItem(__pyx_t_43, __pyx_n_s_channel, __pyx_n_s_int_2) < 0) __PYX_ERR(0, 646, __pyx_L1_error) if (PyDict_SetItem(__pyx_t_43, __pyx_n_s_beg, __pyx_n_s_int_2) < 0) __PYX_ERR(0, 646, __pyx_L1_error) if (PyDict_SetItem(__pyx_t_43, __pyx_n_s_dur, __pyx_n_s_int_2) < 0) __PYX_ERR(0, 646, __pyx_L1_error) __pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_7file2ndarray, 0, __pyx_n_s_file2ndarray_2, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__139)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 646, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_40); __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_40, __pyx_tuple__67); __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_40, __pyx_t_43); __Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0; if (PyDict_SetItem(__pyx_d, __pyx_n_s_file2ndarray_2, __pyx_t_40) < 0) __PYX_ERR(0, 646, __pyx_L1_error) __Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0; __pyx_codeobj__139 = (PyObject*)__Pyx_PyCode_New(4, 0, 0, 11, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__138, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_file2ndarray_2, 646, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__139)) __PYX_ERR(0, 646, __pyx_L1_error)
0647: """
0648: return an ndarray with samples from file and the sample rate of the data
0649:
0650: :param filename: filename
0651: :param channel: if None, will read all channels, otherwise just channel specified
0652: :param beg: beginning positions to read in samples
0653: :param dur: duration in samples to read
0654: :return: tuple of np.ndarray and sample rate
0655: :rtype: tuple
0656:
0657: """
+0658: if not os.path.isfile(filename):
__Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_os); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 658, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_path); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 658, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_isfile); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 658, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = NULL; __pyx_t_4 = 0; #if CYTHON_UNPACK_METHODS if (likely(PyMethod_Check(__pyx_t_2))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); __pyx_t_4 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v_filename}; __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 658, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 658, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_6 = (!__pyx_t_5); if (unlikely(__pyx_t_6)) { /* … */ }
+0659: raise FileNotFoundError(f'file2ndarray: {filename} does not exist.')
__Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_FileNotFoundError); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 659, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 659, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_7 = 0; __pyx_t_8 = 127; __Pyx_INCREF(__pyx_kp_u_file2ndarray); __pyx_t_7 += 14; __Pyx_GIVEREF(__pyx_kp_u_file2ndarray); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_kp_u_file2ndarray); __pyx_t_3 = __Pyx_PyObject_FormatSimple(__pyx_v_filename, __pyx_empty_unicode); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 659, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_8 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3) > __pyx_t_8) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3) : __pyx_t_8; __pyx_t_7 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_3); __pyx_t_3 = 0; __Pyx_INCREF(__pyx_kp_u_does_not_exist); __pyx_t_7 += 16; __Pyx_GIVEREF(__pyx_kp_u_does_not_exist); PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_kp_u_does_not_exist); __pyx_t_3 = __Pyx_PyUnicode_Join(__pyx_t_2, 3, __pyx_t_7, __pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 659, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 659, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __PYX_ERR(0, 659, __pyx_L1_error)
0660:
+0661: length = dur or csndlib.mus_sound_framples(filename)
__pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_dur); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 661, __pyx_L1_error) if (!__pyx_t_6) { } else { __Pyx_INCREF(__pyx_v_dur); __pyx_t_2 = __pyx_v_dur; goto __pyx_L4_bool_binop_done; } __pyx_t_9 = __Pyx_PyObject_AsString(__pyx_v_filename); if (unlikely((!__pyx_t_9) && PyErr_Occurred())) __PYX_ERR(0, 661, __pyx_L1_error) __pyx_t_10 = mus_sound_framples(__pyx_t_9); __pyx_t_3 = __Pyx_PyInt_From_int64_t(__pyx_t_10); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 661, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_2 = __pyx_t_3; __pyx_t_3 = 0; __pyx_L4_bool_binop_done:; __pyx_v_length = __pyx_t_2; __pyx_t_2 = 0;
+0662: chans = csndlib.mus_sound_chans(filename)
__pyx_t_11 = __Pyx_PyObject_AsString(__pyx_v_filename); if (unlikely((!__pyx_t_11) && PyErr_Occurred())) __PYX_ERR(0, 662, __pyx_L1_error) __pyx_v_chans = mus_sound_chans(__pyx_t_11);
+0663: srate = csndlib.mus_sound_srate(filename)
__pyx_t_12 = __Pyx_PyObject_AsString(__pyx_v_filename); if (unlikely((!__pyx_t_12) && PyErr_Occurred())) __PYX_ERR(0, 663, __pyx_L1_error) __pyx_v_srate = mus_sound_srate(__pyx_t_12);
+0664: bg = beg or 0
__pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_beg); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 664, __pyx_L1_error) if (!__pyx_t_6) { } else { __Pyx_INCREF(__pyx_v_beg); __pyx_t_2 = __pyx_v_beg; goto __pyx_L6_bool_binop_done; } __pyx_t_3 = __Pyx_PyInt_From_long(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 664, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_2 = __pyx_t_3; __pyx_t_3 = 0; __pyx_L6_bool_binop_done:; __pyx_v_bg = __pyx_t_2; __pyx_t_2 = 0;
+0665: out = np.zeros((1 if (channel != None) else chans, length), dtype=np.double)
__Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 665, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 665, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_1 = PyObject_RichCompare(__pyx_v_channel, Py_None, Py_NE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 665, __pyx_L1_error) __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 665, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_6) { __Pyx_INCREF(__pyx_int_1); __pyx_t_2 = __pyx_int_1; } else { __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_chans); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 665, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __pyx_t_1; __pyx_t_1 = 0; } __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 665, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_GIVEREF(__pyx_t_2); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2)) __PYX_ERR(0, 665, __pyx_L1_error); __Pyx_INCREF(__pyx_v_length); __Pyx_GIVEREF(__pyx_v_length); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_length)) __PYX_ERR(0, 665, __pyx_L1_error); __pyx_t_2 = 0; __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 665, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_GIVEREF(__pyx_t_1); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1)) __PYX_ERR(0, 665, __pyx_L1_error); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 665, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_GetModuleGlobalName(__pyx_t_13, __pyx_n_s_np); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 665, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_13); __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_n_s_double); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 665, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_14); __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_t_14) < 0) __PYX_ERR(0, 665, __pyx_L1_error) __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; __pyx_t_14 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 665, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_14); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_out = __pyx_t_14; __pyx_t_14 = 0;
0666:
+0667: cdef double [: , :] arr_view = out
__pyx_t_15 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_v_out, PyBUF_WRITABLE); if (unlikely(!__pyx_t_15.memview)) __PYX_ERR(0, 667, __pyx_L1_error) __pyx_v_arr_view = __pyx_t_15; __pyx_t_15.memview = NULL; __pyx_t_15.data = NULL;
0668:
+0669: if channel is None:
__pyx_t_6 = (__pyx_v_channel == ((PyObject*)Py_None));
if (__pyx_t_6) {
/* … */
goto __pyx_L8;
}
+0670: for i in range(chans):
__pyx_t_4 = __pyx_v_chans;
__pyx_t_16 = __pyx_t_4;
for (__pyx_t_17 = 0; __pyx_t_17 < __pyx_t_16; __pyx_t_17+=1) {
__pyx_v_i = __pyx_t_17;
+0671: csndlib.mus_file_to_array(filename, i, bg, length, &arr_view[i][0])
__pyx_t_18 = __Pyx_PyObject_AsString(__pyx_v_filename); if (unlikely((!__pyx_t_18) && PyErr_Occurred())) __PYX_ERR(0, 671, __pyx_L1_error) __pyx_t_10 = __Pyx_PyInt_As_int64_t(__pyx_v_bg); if (unlikely((__pyx_t_10 == ((mus_long_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 671, __pyx_L1_error) __pyx_t_19 = __Pyx_PyInt_As_int64_t(__pyx_v_length); if (unlikely((__pyx_t_19 == ((mus_long_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 671, __pyx_L1_error) __pyx_t_20 = __pyx_v_i; __pyx_t_21 = 0; __pyx_t_22 = -1; if (__pyx_t_20 < 0) { __pyx_t_20 += __pyx_v_arr_view.shape[0]; if (unlikely(__pyx_t_20 < 0)) __pyx_t_22 = 0; } else if (unlikely(__pyx_t_20 >= __pyx_v_arr_view.shape[0])) __pyx_t_22 = 0; if (__pyx_t_21 < 0) { __pyx_t_21 += __pyx_v_arr_view.shape[1]; if (unlikely(__pyx_t_21 < 0)) __pyx_t_22 = 1; } else if (unlikely(__pyx_t_21 >= __pyx_v_arr_view.shape[1])) __pyx_t_22 = 1; if (unlikely(__pyx_t_22 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_22); __PYX_ERR(0, 671, __pyx_L1_error) } (void)(mus_file_to_array(__pyx_t_18, __pyx_v_i, __pyx_t_10, __pyx_t_19, (&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_arr_view.data + __pyx_t_20 * __pyx_v_arr_view.strides[0]) ) + __pyx_t_21 * __pyx_v_arr_view.strides[1]) )))))); }
0672: else:
+0673: csndlib.mus_file_to_array(filename,channel, bg, length, &arr_view[0][0])
/*else*/ {
__pyx_t_18 = __Pyx_PyObject_AsString(__pyx_v_filename); if (unlikely((!__pyx_t_18) && PyErr_Occurred())) __PYX_ERR(0, 673, __pyx_L1_error)
__pyx_t_4 = __Pyx_PyInt_As_int(__pyx_v_channel); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 673, __pyx_L1_error)
__pyx_t_19 = __Pyx_PyInt_As_int64_t(__pyx_v_bg); if (unlikely((__pyx_t_19 == ((mus_long_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 673, __pyx_L1_error)
__pyx_t_10 = __Pyx_PyInt_As_int64_t(__pyx_v_length); if (unlikely((__pyx_t_10 == ((mus_long_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 673, __pyx_L1_error)
__pyx_t_21 = 0;
__pyx_t_20 = 0;
__pyx_t_16 = -1;
if (__pyx_t_21 < 0) {
__pyx_t_21 += __pyx_v_arr_view.shape[0];
if (unlikely(__pyx_t_21 < 0)) __pyx_t_16 = 0;
} else if (unlikely(__pyx_t_21 >= __pyx_v_arr_view.shape[0])) __pyx_t_16 = 0;
if (__pyx_t_20 < 0) {
__pyx_t_20 += __pyx_v_arr_view.shape[1];
if (unlikely(__pyx_t_20 < 0)) __pyx_t_16 = 1;
} else if (unlikely(__pyx_t_20 >= __pyx_v_arr_view.shape[1])) __pyx_t_16 = 1;
if (unlikely(__pyx_t_16 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_16);
__PYX_ERR(0, 673, __pyx_L1_error)
}
(void)(mus_file_to_array(__pyx_t_18, __pyx_t_4, __pyx_t_19, __pyx_t_10, (&(*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_arr_view.data + __pyx_t_21 * __pyx_v_arr_view.strides[0]) ) + __pyx_t_20 * __pyx_v_arr_view.strides[1]) ))))));
}
__pyx_L8:;
+0674: return out, srate
__Pyx_XDECREF(__pyx_r); __pyx_t_14 = __Pyx_PyInt_From_int(__pyx_v_srate); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 674, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_14); __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 674, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_v_out); __Pyx_GIVEREF(__pyx_v_out); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_out)) __PYX_ERR(0, 674, __pyx_L1_error); __Pyx_GIVEREF(__pyx_t_14); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_14)) __PYX_ERR(0, 674, __pyx_L1_error); __pyx_t_14 = 0; __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
0675:
+0676: def ndarray2file(filename: str, arr: npt.NDArray[np.float64], length: int=None, sr: cython.double=None, sample_type: Optional[sndlib.sample]=CLM.sample_type, header_type: Optional[sndlib.header]=CLM.header_type, comment=None ):
static PyObject *__pyx_pf_8pysndlib_3clm_631__defaults__(CYTHON_UNUSED PyObject *__pyx_self) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = PyTuple_New(5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 676, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__Pyx_INCREF(Py_None);
__Pyx_GIVEREF(Py_None);
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, Py_None)) __PYX_ERR(0, 676, __pyx_L1_error);
__Pyx_INCREF(Py_None);
__Pyx_GIVEREF(Py_None);
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, Py_None)) __PYX_ERR(0, 676, __pyx_L1_error);
__Pyx_INCREF(__Pyx_CyFunction_Defaults(__pyx_defaults, __pyx_self)->__pyx_arg_sample_type);
__Pyx_GIVEREF(__Pyx_CyFunction_Defaults(__pyx_defaults, __pyx_self)->__pyx_arg_sample_type);
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 2, __Pyx_CyFunction_Defaults(__pyx_defaults, __pyx_self)->__pyx_arg_sample_type)) __PYX_ERR(0, 676, __pyx_L1_error);
__Pyx_INCREF(__Pyx_CyFunction_Defaults(__pyx_defaults, __pyx_self)->__pyx_arg_header_type);
__Pyx_GIVEREF(__Pyx_CyFunction_Defaults(__pyx_defaults, __pyx_self)->__pyx_arg_header_type);
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 3, __Pyx_CyFunction_Defaults(__pyx_defaults, __pyx_self)->__pyx_arg_header_type)) __PYX_ERR(0, 676, __pyx_L1_error);
__Pyx_INCREF(Py_None);
__Pyx_GIVEREF(Py_None);
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 4, Py_None)) __PYX_ERR(0, 676, __pyx_L1_error);
__pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 676, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__Pyx_GIVEREF(__pyx_t_1);
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1)) __PYX_ERR(0, 676, __pyx_L1_error);
__Pyx_INCREF(Py_None);
__Pyx_GIVEREF(Py_None);
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, Py_None)) __PYX_ERR(0, 676, __pyx_L1_error);
__pyx_t_1 = 0;
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("pysndlib.clm.__defaults__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_9ndarray2file(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_8ndarray2file, "\n write an ndarray of samples to file\n \n :param filename: name of file\n :param arr: np.ndarray of samples\n :param length: length of samples to write. if None write all\n :param sr: sample rate of file to write\n :param sample_type: type of sample type to use. defaults to clm.sample_type\n :param header_type: header of sample type to use. defaults to clm.header_type\n :return: length in samples of file\n :rtype: int\n \n \n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_9ndarray2file = {"ndarray2file", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_9ndarray2file, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_8ndarray2file};
static PyObject *__pyx_pw_8pysndlib_3clm_9ndarray2file(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
PyObject *__pyx_v_filename = 0;
PyObject *__pyx_v_arr = 0;
PyObject *__pyx_v_length = 0;
PyObject *__pyx_v_sr = 0;
PyObject *__pyx_v_sample_type = 0;
PyObject *__pyx_v_header_type = 0;
CYTHON_UNUSED PyObject *__pyx_v_comment = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("ndarray2file (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_filename,&__pyx_n_s_arr,&__pyx_n_s_length,&__pyx_n_s_sr,&__pyx_n_s_sample_type,&__pyx_n_s_header_type,&__pyx_n_s_comment,0};
PyObject* values[7] = {0,0,0,0,0,0,0};
__pyx_defaults *__pyx_dynamic_args = __Pyx_CyFunction_Defaults(__pyx_defaults, __pyx_self);
values[2] = __Pyx_Arg_NewRef_FASTCALL(((PyObject*)Py_None));
values[3] = __Pyx_Arg_NewRef_FASTCALL(((PyObject*)Py_None));
values[4] = __Pyx_Arg_NewRef_FASTCALL(__pyx_dynamic_args->__pyx_arg_sample_type);
values[5] = __Pyx_Arg_NewRef_FASTCALL(__pyx_dynamic_args->__pyx_arg_header_type);
values[6] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 7: values[6] = __Pyx_Arg_FASTCALL(__pyx_args, 6);
CYTHON_FALLTHROUGH;
case 6: values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5);
CYTHON_FALLTHROUGH;
case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4);
CYTHON_FALLTHROUGH;
case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
CYTHON_FALLTHROUGH;
case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_filename)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 676, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_arr)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 676, __pyx_L3_error)
else {
__Pyx_RaiseArgtupleInvalid("ndarray2file", 0, 2, 7, 1); __PYX_ERR(0, 676, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 2:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_length);
if (value) { values[2] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 676, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 3:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_sr);
if (value) { values[3] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 676, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 4:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_sample_type);
if (value) { values[4] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 676, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 5:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_header_type);
if (value) { values[5] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 676, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 6:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_comment);
if (value) { values[6] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 676, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "ndarray2file") < 0)) __PYX_ERR(0, 676, __pyx_L3_error)
}
} else {
switch (__pyx_nargs) {
case 7: values[6] = __Pyx_Arg_FASTCALL(__pyx_args, 6);
CYTHON_FALLTHROUGH;
case 6: values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5);
CYTHON_FALLTHROUGH;
case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4);
CYTHON_FALLTHROUGH;
case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
CYTHON_FALLTHROUGH;
case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
break;
default: goto __pyx_L5_argtuple_error;
}
}
__pyx_v_filename = ((PyObject*)values[0]);
__pyx_v_arr = values[1];
__pyx_v_length = ((PyObject*)values[2]);
__pyx_v_sr = ((PyObject*)values[3]);
__pyx_v_sample_type = values[4];
__pyx_v_header_type = values[5];
__pyx_v_comment = values[6];
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("ndarray2file", 0, 2, 7, __pyx_nargs); __PYX_ERR(0, 676, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.ndarray2file", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_filename), (&PyString_Type), 0, "filename", 1))) __PYX_ERR(0, 676, __pyx_L1_error)
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_length), (&PyInt_Type), 1, "length", 1))) __PYX_ERR(0, 676, __pyx_L1_error)
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_sr), (&PyFloat_Type), 1, "sr", 1))) __PYX_ERR(0, 676, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_8ndarray2file(__pyx_self, __pyx_v_filename, __pyx_v_arr, __pyx_v_length, __pyx_v_sr, __pyx_v_sample_type, __pyx_v_header_type, __pyx_v_comment);
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_8ndarray2file(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_filename, PyObject *__pyx_v_arr, PyObject *__pyx_v_length, PyObject *__pyx_v_sr, PyObject *__pyx_v_sample_type, PyObject *__pyx_v_header_type, CYTHON_UNUSED PyObject *__pyx_v_comment) {
PyObject *__pyx_v_chans = NULL;
int __pyx_v_fd;
mus_float_t **__pyx_v_obuf;
__Pyx_memviewslice __pyx_v_arr_view = { 0, 0, { 0 }, { 0 }, { 0 } };
PyObject *__pyx_v_i = NULL;
CYTHON_UNUSED int __pyx_v_err;
PyObject *__pyx_r = NULL;
__Pyx_INCREF(__pyx_v_length);
__Pyx_INCREF(__pyx_v_sr);
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_XDECREF(__pyx_t_5);
__Pyx_XDECREF(__pyx_t_7);
__PYX_XCLEAR_MEMVIEW(&__pyx_t_13, 1);
__Pyx_AddTraceback("pysndlib.clm.ndarray2file", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XDECREF(__pyx_v_chans);
__PYX_XCLEAR_MEMVIEW(&__pyx_v_arr_view, 1);
__Pyx_XDECREF(__pyx_v_i);
__Pyx_XDECREF(__pyx_v_length);
__Pyx_XDECREF(__pyx_v_sr);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_tuple__140 = PyTuple_Pack(13, __pyx_n_s_filename, __pyx_n_s_arr, __pyx_n_s_length, __pyx_n_s_sr, __pyx_n_s_sample_type, __pyx_n_s_header_type, __pyx_n_s_comment, __pyx_n_s_chans, __pyx_n_s_fd, __pyx_n_s_obuf, __pyx_n_s_arr_view, __pyx_n_s_i, __pyx_n_s_err); if (unlikely(!__pyx_tuple__140)) __PYX_ERR(0, 676, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__140);
__Pyx_GIVEREF(__pyx_tuple__140);
/* … */
__pyx_t_40 = __Pyx_PyDict_NewPresized(6); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 676, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
if (PyDict_SetItem(__pyx_t_40, __pyx_n_s_filename, __pyx_n_s_str_2) < 0) __PYX_ERR(0, 676, __pyx_L1_error)
if (PyDict_SetItem(__pyx_t_40, __pyx_n_s_arr, __pyx_kp_s_npt_NDArray_np_float64) < 0) __PYX_ERR(0, 676, __pyx_L1_error)
if (PyDict_SetItem(__pyx_t_40, __pyx_n_s_length, __pyx_n_s_int_2) < 0) __PYX_ERR(0, 676, __pyx_L1_error)
if (PyDict_SetItem(__pyx_t_40, __pyx_n_s_sr, __pyx_kp_s_cython_double) < 0) __PYX_ERR(0, 676, __pyx_L1_error)
if (PyDict_SetItem(__pyx_t_40, __pyx_n_s_sample_type, __pyx_kp_s_Optional_sndlib_sample) < 0) __PYX_ERR(0, 676, __pyx_L1_error)
if (PyDict_SetItem(__pyx_t_40, __pyx_n_s_header_type, __pyx_kp_s_Optional_sndlib_header) < 0) __PYX_ERR(0, 676, __pyx_L1_error)
__pyx_t_43 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_9ndarray2file, 0, __pyx_n_s_ndarray2file, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__141)); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 676, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
if (!__Pyx_CyFunction_InitDefaults(__pyx_t_43, sizeof(__pyx_defaults), 2)) __PYX_ERR(0, 676, __pyx_L1_error)
__Pyx_GetModuleGlobalName(__pyx_t_37, __pyx_n_s_CLM); if (unlikely(!__pyx_t_37)) __PYX_ERR(0, 676, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_37);
__pyx_t_41 = __Pyx_PyObject_GetAttrStr(__pyx_t_37, __pyx_n_s_sample_type); if (unlikely(!__pyx_t_41)) __PYX_ERR(0, 676, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_41);
__Pyx_DECREF(__pyx_t_37); __pyx_t_37 = 0;
__Pyx_CyFunction_Defaults(__pyx_defaults, __pyx_t_43)->__pyx_arg_sample_type = __pyx_t_41;
__Pyx_GIVEREF(__pyx_t_41);
__pyx_t_41 = 0;
__Pyx_GetModuleGlobalName(__pyx_t_41, __pyx_n_s_CLM); if (unlikely(!__pyx_t_41)) __PYX_ERR(0, 676, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_41);
__pyx_t_37 = __Pyx_PyObject_GetAttrStr(__pyx_t_41, __pyx_n_s_header_type); if (unlikely(!__pyx_t_37)) __PYX_ERR(0, 676, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_37);
__Pyx_DECREF(__pyx_t_41); __pyx_t_41 = 0;
__Pyx_CyFunction_Defaults(__pyx_defaults, __pyx_t_43)->__pyx_arg_header_type = __pyx_t_37;
__Pyx_GIVEREF(__pyx_t_37);
__pyx_t_37 = 0;
__Pyx_CyFunction_SetDefaultsGetter(__pyx_t_43, __pyx_pf_8pysndlib_3clm_631__defaults__);
__Pyx_CyFunction_SetAnnotationsDict(__pyx_t_43, __pyx_t_40);
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
if (PyDict_SetItem(__pyx_d, __pyx_n_s_ndarray2file, __pyx_t_43) < 0) __PYX_ERR(0, 676, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
__pyx_codeobj__141 = (PyObject*)__Pyx_PyCode_New(7, 0, 0, 13, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__140, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_ndarray2file, 676, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__141)) __PYX_ERR(0, 676, __pyx_L1_error)
0677: """
0678: write an ndarray of samples to file
0679:
0680: :param filename: name of file
0681: :param arr: np.ndarray of samples
0682: :param length: length of samples to write. if None write all
0683: :param sr: sample rate of file to write
0684: :param sample_type: type of sample type to use. defaults to clm.sample_type
0685: :param header_type: header of sample type to use. defaults to clm.header_type
0686: :return: length in samples of file
0687: :rtype: int
0688:
0689:
0690: """
0691:
+0692: if not sr:
__pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_sr); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 692, __pyx_L1_error) __pyx_t_2 = (!__pyx_t_1); if (__pyx_t_2) { /* … */ }
+0693: sr = CLM.srate
__Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_CLM); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 693, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_srate); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 693, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (!(likely(PyFloat_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None) || __Pyx_RaiseUnexpectedTypeError("float", __pyx_t_4))) __PYX_ERR(0, 693, __pyx_L1_error) __Pyx_DECREF_SET(__pyx_v_sr, ((PyObject*)__pyx_t_4)); __pyx_t_4 = 0;
0694:
+0695: chans = np.shape(arr)[0]
__Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 695, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_shape); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 695, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = NULL; __pyx_t_6 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_5))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_5, function); __pyx_t_6 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v_arr}; __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 695, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } __pyx_t_5 = __Pyx_GetItemInt(__pyx_t_4, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 695, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_v_chans = __pyx_t_5; __pyx_t_5 = 0;
+0696: length = length or np.shape(arr)[1]
__pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_length); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 696, __pyx_L1_error) if (!__pyx_t_2) { } else { __Pyx_INCREF(__pyx_v_length); __pyx_t_5 = __pyx_v_length; goto __pyx_L4_bool_binop_done; } __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 696, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_shape); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 696, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = NULL; __pyx_t_6 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_7))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_7); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_7, function); __pyx_t_6 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v_arr}; __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_7, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 696, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; } __pyx_t_7 = __Pyx_GetItemInt(__pyx_t_4, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 696, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (!(likely(__Pyx_Py3Int_CheckExact(__pyx_t_7))||((__pyx_t_7) == Py_None) || __Pyx_RaiseUnexpectedTypeError("int", __pyx_t_7))) __PYX_ERR(0, 696, __pyx_L1_error) __Pyx_INCREF(__pyx_t_7); __pyx_t_5 = __pyx_t_7; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_L4_bool_binop_done:; __Pyx_DECREF_SET(__pyx_v_length, ((PyObject*)__pyx_t_5)); __pyx_t_5 = 0;
+0697: fd = csndlib.mus_sound_open_output(filename, int(sr), chans, sample_type, header_type, NULL)
__pyx_t_8 = __Pyx_PyObject_AsString(__pyx_v_filename); if (unlikely((!__pyx_t_8) && PyErr_Occurred())) __PYX_ERR(0, 697, __pyx_L1_error) __pyx_t_5 = __Pyx_PyNumber_Int(__pyx_v_sr); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 697, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_6 = __Pyx_PyInt_As_int(__pyx_t_5); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 697, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_9 = __Pyx_PyInt_As_int(__pyx_v_chans); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 697, __pyx_L1_error) __pyx_t_10 = ((mus_sample_t)__Pyx_PyInt_As_mus_sample_t(__pyx_v_sample_type)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 697, __pyx_L1_error) __pyx_t_11 = ((mus_header_t)__Pyx_PyInt_As_mus_header_t(__pyx_v_header_type)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 697, __pyx_L1_error) __pyx_v_fd = mus_sound_open_output(__pyx_t_8, __pyx_t_6, __pyx_t_9, __pyx_t_10, __pyx_t_11, NULL);
0698:
+0699: cdef cclm.mus_float_t **obuf = <cclm.mus_float_t**>PyMem_Malloc(chans * sizeof(cclm.mus_float_t*))
__pyx_t_5 = __Pyx_PyInt_FromSize_t((sizeof(mus_float_t *))); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 699, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_7 = PyNumber_Multiply(__pyx_v_chans, __pyx_t_5); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 699, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_12 = __Pyx_PyInt_As_size_t(__pyx_t_7); if (unlikely((__pyx_t_12 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 699, __pyx_L1_error) __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_v_obuf = ((mus_float_t **)PyMem_Malloc(__pyx_t_12));
0700:
+0701: if not obuf:
__pyx_t_2 = (!(__pyx_v_obuf != 0));
if (unlikely(__pyx_t_2)) {
/* … */
}
+0702: raise MemoryError()
PyErr_NoMemory(); __PYX_ERR(0, 702, __pyx_L1_error)
0703:
+0704: cdef double [:] arr_view = arr[0]
__pyx_t_7 = __Pyx_GetItemInt(__pyx_v_arr, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 704, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_13 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_7, PyBUF_WRITABLE); if (unlikely(!__pyx_t_13.memview)) __PYX_ERR(0, 704, __pyx_L1_error) __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_v_arr_view = __pyx_t_13; __pyx_t_13.memview = NULL; __pyx_t_13.data = NULL;
0705:
+0706: try:
/*try:*/ {
+0707: for i in range(chans):
__pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_builtin_range, __pyx_v_chans); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 707, __pyx_L8_error) __Pyx_GOTREF(__pyx_t_7); if (likely(PyList_CheckExact(__pyx_t_7)) || PyTuple_CheckExact(__pyx_t_7)) { __pyx_t_5 = __pyx_t_7; __Pyx_INCREF(__pyx_t_5); __pyx_t_14 = 0; __pyx_t_15 = NULL; } else { __pyx_t_14 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 707, __pyx_L8_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_15 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_5); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 707, __pyx_L8_error) } __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; for (;;) { if (likely(!__pyx_t_15)) { if (likely(PyList_CheckExact(__pyx_t_5))) { { Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_5); #if !CYTHON_ASSUME_SAFE_MACROS if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 707, __pyx_L8_error) #endif if (__pyx_t_14 >= __pyx_temp) break; } #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS __pyx_t_7 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_14); __Pyx_INCREF(__pyx_t_7); __pyx_t_14++; if (unlikely((0 < 0))) __PYX_ERR(0, 707, __pyx_L8_error) #else __pyx_t_7 = __Pyx_PySequence_ITEM(__pyx_t_5, __pyx_t_14); __pyx_t_14++; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 707, __pyx_L8_error) __Pyx_GOTREF(__pyx_t_7); #endif } else { { Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_5); #if !CYTHON_ASSUME_SAFE_MACROS if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 707, __pyx_L8_error) #endif if (__pyx_t_14 >= __pyx_temp) break; } #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_14); __Pyx_INCREF(__pyx_t_7); __pyx_t_14++; if (unlikely((0 < 0))) __PYX_ERR(0, 707, __pyx_L8_error) #else __pyx_t_7 = __Pyx_PySequence_ITEM(__pyx_t_5, __pyx_t_14); __pyx_t_14++; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 707, __pyx_L8_error) __Pyx_GOTREF(__pyx_t_7); #endif } } else { __pyx_t_7 = __pyx_t_15(__pyx_t_5); if (unlikely(!__pyx_t_7)) { PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); else __PYX_ERR(0, 707, __pyx_L8_error) } break; } __Pyx_GOTREF(__pyx_t_7); } __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_7); __pyx_t_7 = 0; /* … */ } __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; }
+0708: arr_view = arr[i]
__pyx_t_7 = __Pyx_PyObject_GetItem(__pyx_v_arr, __pyx_v_i); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 708, __pyx_L8_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_13 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_7, PyBUF_WRITABLE); if (unlikely(!__pyx_t_13.memview)) __PYX_ERR(0, 708, __pyx_L8_error) __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __PYX_XCLEAR_MEMVIEW(&__pyx_v_arr_view, 1); __pyx_v_arr_view = __pyx_t_13; __pyx_t_13.memview = NULL; __pyx_t_13.data = NULL;
+0709: obuf[i] = &arr_view[0]
__pyx_t_16 = 0;
__pyx_t_9 = -1;
if (__pyx_t_16 < 0) {
__pyx_t_16 += __pyx_v_arr_view.shape[0];
if (unlikely(__pyx_t_16 < 0)) __pyx_t_9 = 0;
} else if (unlikely(__pyx_t_16 >= __pyx_v_arr_view.shape[0])) __pyx_t_9 = 0;
if (unlikely(__pyx_t_9 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_9);
__PYX_ERR(0, 709, __pyx_L8_error)
}
__pyx_t_17 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_17 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 709, __pyx_L8_error)
(__pyx_v_obuf[__pyx_t_17]) = (&(*((double *) ( /* dim=0 */ (__pyx_v_arr_view.data + __pyx_t_16 * __pyx_v_arr_view.strides[0]) ))));
0710:
0711: finally:
+0712: err = csndlib.mus_file_write(fd, 0, length, chans, obuf)
/*finally:*/ {
/*normal exit:*/{
__pyx_t_18 = __Pyx_PyInt_As_int64_t(__pyx_v_length); if (unlikely((__pyx_t_18 == ((mus_long_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 712, __pyx_L1_error)
__pyx_t_9 = __Pyx_PyInt_As_int(__pyx_v_chans); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 712, __pyx_L1_error)
__pyx_v_err = mus_file_write(__pyx_v_fd, 0, __pyx_t_18, __pyx_t_9, __pyx_v_obuf);
/* … */
__pyx_t_18 = __Pyx_PyInt_As_int64_t(__pyx_v_length); if (unlikely((__pyx_t_18 == ((mus_long_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 712, __pyx_L14_error)
__pyx_t_26 = __Pyx_PyInt_As_int(__pyx_v_chans); if (unlikely((__pyx_t_26 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 712, __pyx_L14_error)
__pyx_v_err = mus_file_write(__pyx_v_fd, 0, __pyx_t_18, __pyx_t_26, __pyx_v_obuf);
+0713: csndlib.mus_sound_close_output(fd, length * csndlib.mus_bytes_per_sample(sample_type)*chans)
__pyx_t_10 = ((mus_sample_t)__Pyx_PyInt_As_mus_sample_t(__pyx_v_sample_type)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 713, __pyx_L1_error) __pyx_t_5 = __Pyx_PyInt_From_int(mus_bytes_per_sample(__pyx_t_10)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 713, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_7 = PyNumber_Multiply(__pyx_v_length, __pyx_t_5); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 713, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_5 = PyNumber_Multiply(__pyx_t_7, __pyx_v_chans); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 713, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_18 = __Pyx_PyInt_As_int64_t(__pyx_t_5); if (unlikely((__pyx_t_18 == ((mus_long_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 713, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; (void)(mus_sound_close_output(__pyx_v_fd, __pyx_t_18)); /* … */ __pyx_t_10 = ((mus_sample_t)__Pyx_PyInt_As_mus_sample_t(__pyx_v_sample_type)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 713, __pyx_L14_error) __pyx_t_5 = __Pyx_PyInt_From_int(mus_bytes_per_sample(__pyx_t_10)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 713, __pyx_L14_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_7 = PyNumber_Multiply(__pyx_v_length, __pyx_t_5); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 713, __pyx_L14_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_5 = PyNumber_Multiply(__pyx_t_7, __pyx_v_chans); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 713, __pyx_L14_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_18 = __Pyx_PyInt_As_int64_t(__pyx_t_5); if (unlikely((__pyx_t_18 == ((mus_long_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 713, __pyx_L14_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; (void)(mus_sound_close_output(__pyx_v_fd, __pyx_t_18));
+0714: PyMem_Free(obuf)
PyMem_Free(__pyx_v_obuf); goto __pyx_L9; } __pyx_L8_error:; /*exception exit:*/{ __Pyx_PyThreadState_declare __Pyx_PyThreadState_assign __pyx_t_20 = 0; __pyx_t_21 = 0; __pyx_t_22 = 0; __pyx_t_23 = 0; __pyx_t_24 = 0; __pyx_t_25 = 0; __PYX_XCLEAR_MEMVIEW(&__pyx_t_13, 1); __pyx_t_13.memview = NULL; __pyx_t_13.data = NULL; __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_23, &__pyx_t_24, &__pyx_t_25); if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_20, &__pyx_t_21, &__pyx_t_22) < 0)) __Pyx_ErrFetch(&__pyx_t_20, &__pyx_t_21, &__pyx_t_22); __Pyx_XGOTREF(__pyx_t_20); __Pyx_XGOTREF(__pyx_t_21); __Pyx_XGOTREF(__pyx_t_22); __Pyx_XGOTREF(__pyx_t_23); __Pyx_XGOTREF(__pyx_t_24); __Pyx_XGOTREF(__pyx_t_25); __pyx_t_9 = __pyx_lineno; __pyx_t_6 = __pyx_clineno; __pyx_t_19 = __pyx_filename; { /* … */ PyMem_Free(__pyx_v_obuf); } if (PY_MAJOR_VERSION >= 3) { __Pyx_XGIVEREF(__pyx_t_23); __Pyx_XGIVEREF(__pyx_t_24); __Pyx_XGIVEREF(__pyx_t_25); __Pyx_ExceptionReset(__pyx_t_23, __pyx_t_24, __pyx_t_25); } __Pyx_XGIVEREF(__pyx_t_20); __Pyx_XGIVEREF(__pyx_t_21); __Pyx_XGIVEREF(__pyx_t_22); __Pyx_ErrRestore(__pyx_t_20, __pyx_t_21, __pyx_t_22); __pyx_t_20 = 0; __pyx_t_21 = 0; __pyx_t_22 = 0; __pyx_t_23 = 0; __pyx_t_24 = 0; __pyx_t_25 = 0; __pyx_lineno = __pyx_t_9; __pyx_clineno = __pyx_t_6; __pyx_filename = __pyx_t_19; goto __pyx_L1_error; __pyx_L14_error:; if (PY_MAJOR_VERSION >= 3) { __Pyx_XGIVEREF(__pyx_t_23); __Pyx_XGIVEREF(__pyx_t_24); __Pyx_XGIVEREF(__pyx_t_25); __Pyx_ExceptionReset(__pyx_t_23, __pyx_t_24, __pyx_t_25); } __Pyx_XDECREF(__pyx_t_20); __pyx_t_20 = 0; __Pyx_XDECREF(__pyx_t_21); __pyx_t_21 = 0; __Pyx_XDECREF(__pyx_t_22); __pyx_t_22 = 0; __pyx_t_23 = 0; __pyx_t_24 = 0; __pyx_t_25 = 0; goto __pyx_L1_error; } __pyx_L9:; }
0715:
+0716: return length
__Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_v_length); __pyx_r = __pyx_v_length; goto __pyx_L0;
0717:
0718: # --------------- with sound context manager ---------------- #
+0719: class Sound(object):
__pyx_tuple__142 = PyTuple_Pack(1, __pyx_builtin_object); if (unlikely(!__pyx_tuple__142)) __PYX_ERR(0, 719, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__142); __Pyx_GIVEREF(__pyx_tuple__142); /* … */ __pyx_t_43 = __Pyx_PEP560_update_bases(__pyx_tuple__143); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 719, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_43); __pyx_t_40 = __Pyx_CalculateMetaclass(NULL, __pyx_t_43); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 719, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_40); __pyx_t_37 = __Pyx_Py3MetaclassPrepare(__pyx_t_40, __pyx_t_43, __pyx_n_s_Sound, __pyx_n_s_Sound, (PyObject *) NULL, __pyx_n_s_pysndlib_clm, __pyx_kp_s_context_manager_which_handles_c); if (unlikely(!__pyx_t_37)) __PYX_ERR(0, 719, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_37); if (__pyx_t_43 != __pyx_tuple__143) { if (unlikely((PyDict_SetItemString(__pyx_t_37, "__orig_bases__", __pyx_tuple__143) < 0))) __PYX_ERR(0, 719, __pyx_L1_error) } __pyx_tuple__143 = PyTuple_Pack(1, __pyx_builtin_object); if (unlikely(!__pyx_tuple__143)) __PYX_ERR(0, 719, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__143); __Pyx_GIVEREF(__pyx_tuple__143); /* … */ __pyx_t_41 = __Pyx_Py3ClassCreate(__pyx_t_40, __pyx_n_s_Sound, __pyx_t_43, __pyx_t_37, NULL, 0, 0); if (unlikely(!__pyx_t_41)) __PYX_ERR(0, 719, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_41); if (PyDict_SetItem(__pyx_d, __pyx_n_s_Sound, __pyx_t_41) < 0) __PYX_ERR(0, 719, __pyx_L1_error) __Pyx_DECREF(__pyx_t_41); __pyx_t_41 = 0; __Pyx_DECREF(__pyx_t_37); __pyx_t_37 = 0; __Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0; __Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
0720: """
0721: context manager which handles creating output and other options
0722:
0723: :param output: Can be a filename string or np.ndarray
0724: :param channels: number of channels \in main output
0725: :param srate: output sampling rate
0726: :param sample_type: output sample data type
0727: :param header_type: output header type
0728: :param comment: any comment to store \in the header
0729: :param verbose: if True, print out some info (doesn't do anything now)
0730: :param reverb: reverb instrument
0731: :param reverb_data: arguments passed to the reverb (dictionary)
0732: :param reverb_channels: chans \in the reverb intermediate file
0733: :param revfile: reverb intermediate output file name
0734: :param continue_old_file: if True, continue a previous computation
0735: :param statistics: if True, print info at end of with-sound (compile time, maxamps)
0736: :param scaled_to: if a number, scale the output to peak at that amp
0737: :param scaled_by: is a number, scale output by that amp
0738: :param play: if True, play the sound automatically
0739: :param finalize: a function to call on exit from the context. should be a function that takes one argument, the name of the sound file or the ndarray
0740: used as output
0741: """
0742:
+0743: def __init__(self, output=None,
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_5Sound_1__init__(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_8pysndlib_3clm_5Sound_1__init__ = {"__init__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_5Sound_1__init__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_8pysndlib_3clm_5Sound_1__init__(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
PyObject *__pyx_v_self = 0;
PyObject *__pyx_v_output = 0;
PyObject *__pyx_v_channels = 0;
PyObject *__pyx_v_srate = 0;
PyObject *__pyx_v_sample_type = 0;
PyObject *__pyx_v_header_type = 0;
PyObject *__pyx_v_comment = 0;
PyObject *__pyx_v_verbose = 0;
PyObject *__pyx_v_reverb = 0;
PyObject *__pyx_v_revfile = 0;
PyObject *__pyx_v_reverb_data = 0;
PyObject *__pyx_v_reverb_channels = 0;
PyObject *__pyx_v_continue_old_file = 0;
PyObject *__pyx_v_statistics = 0;
PyObject *__pyx_v_scaled_to = 0;
PyObject *__pyx_v_scaled_by = 0;
PyObject *__pyx_v_play = 0;
PyObject *__pyx_v_clipped = 0;
PyObject *__pyx_v_finalize = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_output,&__pyx_n_s_channels,&__pyx_n_s_srate,&__pyx_n_s_sample_type,&__pyx_n_s_header_type,&__pyx_n_s_comment,&__pyx_n_s_verbose,&__pyx_n_s_reverb,&__pyx_n_s_revfile,&__pyx_n_s_reverb_data,&__pyx_n_s_reverb_channels,&__pyx_n_s_continue_old_file,&__pyx_n_s_statistics,&__pyx_n_s_scaled_to,&__pyx_n_s_scaled_by,&__pyx_n_s_play,&__pyx_n_s_clipped,&__pyx_n_s_finalize,0};
PyObject* values[19] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
values[1] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
/* … */
/* function exit code */
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_5Sound___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_output, PyObject *__pyx_v_channels, PyObject *__pyx_v_srate, PyObject *__pyx_v_sample_type, PyObject *__pyx_v_header_type, PyObject *__pyx_v_comment, PyObject *__pyx_v_verbose, PyObject *__pyx_v_reverb, PyObject *__pyx_v_revfile, PyObject *__pyx_v_reverb_data, PyObject *__pyx_v_reverb_channels, PyObject *__pyx_v_continue_old_file, PyObject *__pyx_v_statistics, PyObject *__pyx_v_scaled_to, PyObject *__pyx_v_scaled_by, PyObject *__pyx_v_play, PyObject *__pyx_v_clipped, PyObject *__pyx_v_finalize) {
PyObject *__pyx_r = NULL;
/* … */
/* function exit code */
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_AddTraceback("pysndlib.clm.Sound.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_tuple__144 = PyTuple_Pack(19, __pyx_n_s_self, __pyx_n_s_output, __pyx_n_s_channels, __pyx_n_s_srate, __pyx_n_s_sample_type, __pyx_n_s_header_type, __pyx_n_s_comment, __pyx_n_s_verbose, __pyx_n_s_reverb, __pyx_n_s_revfile, __pyx_n_s_reverb_data, __pyx_n_s_reverb_channels, __pyx_n_s_continue_old_file, __pyx_n_s_statistics, __pyx_n_s_scaled_to, __pyx_n_s_scaled_by, __pyx_n_s_play, __pyx_n_s_clipped, __pyx_n_s_finalize); if (unlikely(!__pyx_tuple__144)) __PYX_ERR(0, 743, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__144);
__Pyx_GIVEREF(__pyx_tuple__144);
__pyx_codeobj__145 = (PyObject*)__Pyx_PyCode_New(19, 0, 0, 19, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__144, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_init, 743, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__145)) __PYX_ERR(0, 743, __pyx_L1_error)
/* … */
__pyx_t_41 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_5Sound_1__init__, 0, __pyx_n_s_Sound___init, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__145)); if (unlikely(!__pyx_t_41)) __PYX_ERR(0, 743, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_41);
__Pyx_CyFunction_SetDefaultsTuple(__pyx_t_41, __pyx_tuple__146);
if (__Pyx_SetNameInClass(__pyx_t_37, __pyx_n_s_init, __pyx_t_41) < 0) __PYX_ERR(0, 743, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_41); __pyx_t_41 = 0;
__pyx_tuple__146 = PyTuple_Pack(18, Py_None, Py_None, Py_None, Py_None, Py_None, ((PyObject *)Py_False), ((PyObject *)Py_False), Py_None, Py_None, Py_None, Py_None, ((PyObject *)Py_False), Py_None, ((PyObject *)Py_False), ((PyObject *)Py_False), Py_None, Py_None, Py_None); if (unlikely(!__pyx_tuple__146)) __PYX_ERR(0, 743, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__146);
__Pyx_GIVEREF(__pyx_tuple__146);
+0744: channels=None,
values[2] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
+0745: srate=None,
values[3] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
+0746: sample_type = None,
values[4] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
+0747: header_type = None,
values[5] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
+0748: comment = False,
values[6] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)((PyObject *)Py_False)));
+0749: verbose = False,
values[7] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)((PyObject *)Py_False)));
+0750: reverb = None,
values[8] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
+0751: revfile = None,
values[9] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
+0752: reverb_data = None,
values[10] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
+0753: reverb_channels = None,
values[11] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
+0754: continue_old_file = False,
values[12] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)((PyObject *)Py_False)));
+0755: statistics = None,
values[13] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
+0756: scaled_to = False,
values[14] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)((PyObject *)Py_False)));
+0757: scaled_by = False,
values[15] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)((PyObject *)Py_False)));
+0758: play = None,
values[16] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
+0759: clipped = None,
values[17] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
+0760: finalize = None):
values[18] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None)); if (__pyx_kwds) { Py_ssize_t kw_args; switch (__pyx_nargs) { case 19: values[18] = __Pyx_Arg_FASTCALL(__pyx_args, 18); CYTHON_FALLTHROUGH; case 18: values[17] = __Pyx_Arg_FASTCALL(__pyx_args, 17); CYTHON_FALLTHROUGH; case 17: values[16] = __Pyx_Arg_FASTCALL(__pyx_args, 16); CYTHON_FALLTHROUGH; case 16: values[15] = __Pyx_Arg_FASTCALL(__pyx_args, 15); CYTHON_FALLTHROUGH; case 15: values[14] = __Pyx_Arg_FASTCALL(__pyx_args, 14); CYTHON_FALLTHROUGH; case 14: values[13] = __Pyx_Arg_FASTCALL(__pyx_args, 13); CYTHON_FALLTHROUGH; case 13: values[12] = __Pyx_Arg_FASTCALL(__pyx_args, 12); CYTHON_FALLTHROUGH; case 12: values[11] = __Pyx_Arg_FASTCALL(__pyx_args, 11); CYTHON_FALLTHROUGH; case 11: values[10] = __Pyx_Arg_FASTCALL(__pyx_args, 10); CYTHON_FALLTHROUGH; case 10: values[9] = __Pyx_Arg_FASTCALL(__pyx_args, 9); CYTHON_FALLTHROUGH; case 9: values[8] = __Pyx_Arg_FASTCALL(__pyx_args, 8); CYTHON_FALLTHROUGH; case 8: values[7] = __Pyx_Arg_FASTCALL(__pyx_args, 7); CYTHON_FALLTHROUGH; case 7: values[6] = __Pyx_Arg_FASTCALL(__pyx_args, 6); CYTHON_FALLTHROUGH; case 6: values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); CYTHON_FALLTHROUGH; case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); CYTHON_FALLTHROUGH; case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); CYTHON_FALLTHROUGH; case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); CYTHON_FALLTHROUGH; case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); CYTHON_FALLTHROUGH; case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); switch (__pyx_nargs) { case 0: if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_self)) != 0)) { (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); kw_args--; } else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 743, __pyx_L3_error) else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: if (kw_args > 0) { PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_output); if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 743, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: if (kw_args > 0) { PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_channels); if (value) { values[2] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 743, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 3: if (kw_args > 0) { PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_srate); if (value) { values[3] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 743, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 4: if (kw_args > 0) { PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_sample_type); if (value) { values[4] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 743, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 5: if (kw_args > 0) { PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_header_type); if (value) { values[5] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 743, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 6: if (kw_args > 0) { PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_comment); if (value) { values[6] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 743, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 7: if (kw_args > 0) { PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_verbose); if (value) { values[7] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 743, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 8: if (kw_args > 0) { PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_reverb); if (value) { values[8] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 743, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 9: if (kw_args > 0) { PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_revfile); if (value) { values[9] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 743, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 10: if (kw_args > 0) { PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_reverb_data); if (value) { values[10] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 743, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 11: if (kw_args > 0) { PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_reverb_channels); if (value) { values[11] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 743, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 12: if (kw_args > 0) { PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_continue_old_file); if (value) { values[12] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 743, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 13: if (kw_args > 0) { PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_statistics); if (value) { values[13] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 743, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 14: if (kw_args > 0) { PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_scaled_to); if (value) { values[14] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 743, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 15: if (kw_args > 0) { PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_scaled_by); if (value) { values[15] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 743, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 16: if (kw_args > 0) { PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_play); if (value) { values[16] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 743, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 17: if (kw_args > 0) { PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_clipped); if (value) { values[17] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 743, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 18: if (kw_args > 0) { PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_finalize); if (value) { values[18] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 743, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { const Py_ssize_t kwd_pos_args = __pyx_nargs; if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__init__") < 0)) __PYX_ERR(0, 743, __pyx_L3_error) } } else { switch (__pyx_nargs) { case 19: values[18] = __Pyx_Arg_FASTCALL(__pyx_args, 18); CYTHON_FALLTHROUGH; case 18: values[17] = __Pyx_Arg_FASTCALL(__pyx_args, 17); CYTHON_FALLTHROUGH; case 17: values[16] = __Pyx_Arg_FASTCALL(__pyx_args, 16); CYTHON_FALLTHROUGH; case 16: values[15] = __Pyx_Arg_FASTCALL(__pyx_args, 15); CYTHON_FALLTHROUGH; case 15: values[14] = __Pyx_Arg_FASTCALL(__pyx_args, 14); CYTHON_FALLTHROUGH; case 14: values[13] = __Pyx_Arg_FASTCALL(__pyx_args, 13); CYTHON_FALLTHROUGH; case 13: values[12] = __Pyx_Arg_FASTCALL(__pyx_args, 12); CYTHON_FALLTHROUGH; case 12: values[11] = __Pyx_Arg_FASTCALL(__pyx_args, 11); CYTHON_FALLTHROUGH; case 11: values[10] = __Pyx_Arg_FASTCALL(__pyx_args, 10); CYTHON_FALLTHROUGH; case 10: values[9] = __Pyx_Arg_FASTCALL(__pyx_args, 9); CYTHON_FALLTHROUGH; case 9: values[8] = __Pyx_Arg_FASTCALL(__pyx_args, 8); CYTHON_FALLTHROUGH; case 8: values[7] = __Pyx_Arg_FASTCALL(__pyx_args, 7); CYTHON_FALLTHROUGH; case 7: values[6] = __Pyx_Arg_FASTCALL(__pyx_args, 6); CYTHON_FALLTHROUGH; case 6: values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); CYTHON_FALLTHROUGH; case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); CYTHON_FALLTHROUGH; case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); CYTHON_FALLTHROUGH; case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); CYTHON_FALLTHROUGH; case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); CYTHON_FALLTHROUGH; case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); break; default: goto __pyx_L5_argtuple_error; } } __pyx_v_self = values[0]; __pyx_v_output = values[1]; __pyx_v_channels = values[2]; __pyx_v_srate = values[3]; __pyx_v_sample_type = values[4]; __pyx_v_header_type = values[5]; __pyx_v_comment = values[6]; __pyx_v_verbose = values[7]; __pyx_v_reverb = values[8]; __pyx_v_revfile = values[9]; __pyx_v_reverb_data = values[10]; __pyx_v_reverb_channels = values[11]; __pyx_v_continue_old_file = values[12]; __pyx_v_statistics = values[13]; __pyx_v_scaled_to = values[14]; __pyx_v_scaled_by = values[15]; __pyx_v_play = values[16]; __pyx_v_clipped = values[17]; __pyx_v_finalize = values[18]; } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 19, __pyx_nargs); __PYX_ERR(0, 743, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; { Py_ssize_t __pyx_temp; for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); } } __Pyx_AddTraceback("pysndlib.clm.Sound.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_8pysndlib_3clm_5Sound___init__(__pyx_self, __pyx_v_self, __pyx_v_output, __pyx_v_channels, __pyx_v_srate, __pyx_v_sample_type, __pyx_v_header_type, __pyx_v_comment, __pyx_v_verbose, __pyx_v_reverb, __pyx_v_revfile, __pyx_v_reverb_data, __pyx_v_reverb_channels, __pyx_v_continue_old_file, __pyx_v_statistics, __pyx_v_scaled_to, __pyx_v_scaled_by, __pyx_v_play, __pyx_v_clipped, __pyx_v_finalize);
+0761: self.output = output if output is not None else CLM.file_name
__pyx_t_2 = (__pyx_v_output != Py_None);
if (__pyx_t_2) {
__Pyx_INCREF(__pyx_v_output);
__pyx_t_1 = __pyx_v_output;
} else {
__Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_CLM); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 761, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_file_name); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 761, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_1 = __pyx_t_4;
__pyx_t_4 = 0;
}
if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_output, __pyx_t_1) < 0) __PYX_ERR(0, 761, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+0762: self.channels = channels if channels is not None else CLM.channels
__pyx_t_2 = (__pyx_v_channels != Py_None);
if (__pyx_t_2) {
__Pyx_INCREF(__pyx_v_channels);
__pyx_t_1 = __pyx_v_channels;
} else {
__Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_CLM); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 762, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
__pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_channels); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 762, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__pyx_t_1 = __pyx_t_3;
__pyx_t_3 = 0;
}
if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_channels, __pyx_t_1) < 0) __PYX_ERR(0, 762, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+0763: self.srate = srate if srate is not None else CLM.srate
__pyx_t_2 = (__pyx_v_srate != Py_None);
if (__pyx_t_2) {
__Pyx_INCREF(__pyx_v_srate);
__pyx_t_1 = __pyx_v_srate;
} else {
__Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_CLM); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 763, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_srate); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 763, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_1 = __pyx_t_4;
__pyx_t_4 = 0;
}
if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_srate, __pyx_t_1) < 0) __PYX_ERR(0, 763, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+0764: self.sample_type = sample_type if sample_type is not None else CLM.sample_type
__pyx_t_2 = (__pyx_v_sample_type != Py_None);
if (__pyx_t_2) {
__Pyx_INCREF(__pyx_v_sample_type);
__pyx_t_1 = __pyx_v_sample_type;
} else {
__Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_CLM); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 764, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
__pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_sample_type); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 764, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__pyx_t_1 = __pyx_t_3;
__pyx_t_3 = 0;
}
if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_sample_type, __pyx_t_1) < 0) __PYX_ERR(0, 764, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+0765: self.header_type = header_type if header_type is not None else CLM.header_type
__pyx_t_2 = (__pyx_v_header_type != Py_None);
if (__pyx_t_2) {
__Pyx_INCREF(__pyx_v_header_type);
__pyx_t_1 = __pyx_v_header_type;
} else {
__Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_CLM); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 765, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_header_type); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 765, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_1 = __pyx_t_4;
__pyx_t_4 = 0;
}
if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_header_type, __pyx_t_1) < 0) __PYX_ERR(0, 765, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+0766: self.comment = comment
if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_comment, __pyx_v_comment) < 0) __PYX_ERR(0, 766, __pyx_L1_error)
+0767: self.verbose = verbose if verbose is not None else CLM.verbose
__pyx_t_2 = (__pyx_v_verbose != Py_None);
if (__pyx_t_2) {
__Pyx_INCREF(__pyx_v_verbose);
__pyx_t_1 = __pyx_v_verbose;
} else {
__Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_CLM); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 767, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
__pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_verbose); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 767, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__pyx_t_1 = __pyx_t_3;
__pyx_t_3 = 0;
}
if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_verbose, __pyx_t_1) < 0) __PYX_ERR(0, 767, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+0768: self.reverb = reverb
if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_reverb, __pyx_v_reverb) < 0) __PYX_ERR(0, 768, __pyx_L1_error)
+0769: self.revfile = revfile if revfile is not None else CLM.reverb_file_name
__pyx_t_2 = (__pyx_v_revfile != Py_None);
if (__pyx_t_2) {
__Pyx_INCREF(__pyx_v_revfile);
__pyx_t_1 = __pyx_v_revfile;
} else {
__Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_CLM); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 769, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_reverb_file_name); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 769, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_1 = __pyx_t_4;
__pyx_t_4 = 0;
}
if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_revfile, __pyx_t_1) < 0) __PYX_ERR(0, 769, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+0770: self.reverb_data = reverb_data if reverb_data is not None else CLM.reverb_data
__pyx_t_2 = (__pyx_v_reverb_data != Py_None);
if (__pyx_t_2) {
__Pyx_INCREF(__pyx_v_reverb_data);
__pyx_t_1 = __pyx_v_reverb_data;
} else {
__Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_CLM); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 770, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
__pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_reverb_data); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 770, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__pyx_t_1 = __pyx_t_3;
__pyx_t_3 = 0;
}
if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_reverb_data, __pyx_t_1) < 0) __PYX_ERR(0, 770, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+0771: self.reverb_channels = reverb_channels if reverb_channels is not None else CLM.reverb_channels
__pyx_t_2 = (__pyx_v_reverb_channels != Py_None);
if (__pyx_t_2) {
__Pyx_INCREF(__pyx_v_reverb_channels);
__pyx_t_1 = __pyx_v_reverb_channels;
} else {
__Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_CLM); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 771, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_reverb_channels); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 771, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_1 = __pyx_t_4;
__pyx_t_4 = 0;
}
if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_reverb_channels, __pyx_t_1) < 0) __PYX_ERR(0, 771, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+0772: self.continue_old_file = continue_old_file
if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_continue_old_file, __pyx_v_continue_old_file) < 0) __PYX_ERR(0, 772, __pyx_L1_error)
+0773: self.statistics = statistics if statistics is not None else CLM.statistics
__pyx_t_2 = (__pyx_v_statistics != Py_None);
if (__pyx_t_2) {
__Pyx_INCREF(__pyx_v_statistics);
__pyx_t_1 = __pyx_v_statistics;
} else {
__Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_CLM); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 773, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
__pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_statistics); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 773, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__pyx_t_1 = __pyx_t_3;
__pyx_t_3 = 0;
}
if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_statistics, __pyx_t_1) < 0) __PYX_ERR(0, 773, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+0774: self.scaled_to = scaled_to
if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_scaled_to, __pyx_v_scaled_to) < 0) __PYX_ERR(0, 774, __pyx_L1_error)
+0775: self.scaled_by = scaled_by
if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_scaled_by, __pyx_v_scaled_by) < 0) __PYX_ERR(0, 775, __pyx_L1_error)
+0776: self.play = play if play is not None else CLM.play
__pyx_t_2 = (__pyx_v_play != Py_None);
if (__pyx_t_2) {
__Pyx_INCREF(__pyx_v_play);
__pyx_t_1 = __pyx_v_play;
} else {
__Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_CLM); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 776, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_play); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 776, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_1 = __pyx_t_4;
__pyx_t_4 = 0;
}
if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_play, __pyx_t_1) < 0) __PYX_ERR(0, 776, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+0777: self.clipped = clipped if clipped is not None else CLM.clipped
__pyx_t_2 = (__pyx_v_clipped != Py_None);
if (__pyx_t_2) {
__Pyx_INCREF(__pyx_v_clipped);
__pyx_t_1 = __pyx_v_clipped;
} else {
__Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_CLM); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 777, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
__pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_clipped); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 777, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__pyx_t_1 = __pyx_t_3;
__pyx_t_3 = 0;
}
if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_clipped, __pyx_t_1) < 0) __PYX_ERR(0, 777, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+0778: self.output_to_file = isinstance(self.output, str)
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_output); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 778, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = PyString_Check(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 778, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_output_to_file, __pyx_t_1) < 0) __PYX_ERR(0, 778, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+0779: self.reverb_to_file = self.reverb is not None and isinstance(self.output, str)
__pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_reverb); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 779, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_2 = (__pyx_t_3 != Py_None); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_2) { } else { __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 779, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_1 = __pyx_t_3; __pyx_t_3 = 0; goto __pyx_L3_bool_binop_done; } __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_output); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 779, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_2 = PyString_Check(__pyx_t_3); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 779, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_1 = __pyx_t_3; __pyx_t_3 = 0; __pyx_L3_bool_binop_done:; if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_reverb_to_file, __pyx_t_1) < 0) __PYX_ERR(0, 779, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+0780: self.old_srate = get_srate()
__pyx_t_5 = __pyx_f_8pysndlib_3clm_get_srate(0); if (unlikely(__pyx_t_5 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 780, __pyx_L1_error) __pyx_t_1 = PyFloat_FromDouble(__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 780, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_old_srate, __pyx_t_1) < 0) __PYX_ERR(0, 780, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+0781: self.finalize = finalize
if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_finalize, __pyx_v_finalize) < 0) __PYX_ERR(0, 781, __pyx_L1_error)
0782:
+0783: def __enter__(self):
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_5Sound_3__enter__(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_8pysndlib_3clm_5Sound_3__enter__ = {"__enter__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_5Sound_3__enter__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_8pysndlib_3clm_5Sound_3__enter__(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
PyObject *__pyx_v_self = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__enter__ (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,0};
PyObject* values[1] = {0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_self)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 783, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__enter__") < 0)) __PYX_ERR(0, 783, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 1)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
}
__pyx_v_self = values[0];
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("__enter__", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 783, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.Sound.__enter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_8pysndlib_3clm_5Sound_2__enter__(__pyx_self, __pyx_v_self);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_5Sound_2__enter__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
PyObject *__pyx_r = NULL;
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_XDECREF(__pyx_t_5);
__Pyx_XDECREF(__pyx_t_11);
__Pyx_XDECREF(__pyx_t_12);
__Pyx_XDECREF(__pyx_t_16);
__Pyx_AddTraceback("pysndlib.clm.Sound.__enter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_41 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_5Sound_3__enter__, 0, __pyx_n_s_Sound___enter, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__147)); if (unlikely(!__pyx_t_41)) __PYX_ERR(0, 783, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_41);
if (__Pyx_SetNameInClass(__pyx_t_37, __pyx_n_s_enter, __pyx_t_41) < 0) __PYX_ERR(0, 783, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_41); __pyx_t_41 = 0;
/* … */
__pyx_codeobj__147 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__91, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_enter, 783, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__147)) __PYX_ERR(0, 783, __pyx_L1_error)
0784:
+0785: if not self.clipped:
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_clipped); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 785, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 785, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_3 = (!__pyx_t_2); if (__pyx_t_3) { /* … */ goto __pyx_L3; }
+0786: if (self.scaled_by or self.scaled_to) and (self.sample_type in [Sample.BFLOAT, Sample.LFLOAT, Sample.BDOUBLE, Sample.LDOUBLE]):
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_scaled_by); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 786, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 786, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (!__pyx_t_2) { } else { goto __pyx_L6_next_and; } __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_scaled_to); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 786, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 786, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_2) { } else { __pyx_t_3 = __pyx_t_2; goto __pyx_L5_bool_binop_done; } __pyx_L6_next_and:; __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_sample_type); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 786, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_Sample); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 786, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_BFLOAT); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 786, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = PyObject_RichCompare(__pyx_t_1, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 786, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 786, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (!__pyx_t_6) { } else { __pyx_t_2 = __pyx_t_6; goto __pyx_L8_bool_binop_done; } __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_Sample); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 786, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_LFLOAT); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 786, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = PyObject_RichCompare(__pyx_t_1, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 786, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 786, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (!__pyx_t_6) { } else { __pyx_t_2 = __pyx_t_6; goto __pyx_L8_bool_binop_done; } __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_Sample); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 786, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_BDOUBLE); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 786, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = PyObject_RichCompare(__pyx_t_1, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 786, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 786, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (!__pyx_t_6) { } else { __pyx_t_2 = __pyx_t_6; goto __pyx_L8_bool_binop_done; } __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_Sample); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 786, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_LDOUBLE); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 786, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = PyObject_RichCompare(__pyx_t_1, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 786, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 786, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_2 = __pyx_t_6; __pyx_L8_bool_binop_done:; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_6 = __pyx_t_2; __pyx_t_3 = __pyx_t_6; __pyx_L5_bool_binop_done:; if (__pyx_t_3) { /* … */ goto __pyx_L4; }
+0787: csndlib.mus_set_clipping(False)
(void)(mus_set_clipping(0));
0788: else:
+0789: csndlib.mus_set_clipping(CLM.clipped)
/*else*/ {
__Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_CLM); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 789, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_clipped); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 789, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 789, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
(void)(mus_set_clipping(__pyx_t_3));
}
__pyx_L4:;
0790: else:
+0791: csndlib.mus_set_clipping(self.clipped)
/*else*/ {
__pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_clipped); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 791, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
__pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 791, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
(void)(mus_set_clipping(__pyx_t_3));
}
__pyx_L3:;
0792:
+0793: set_srate(self.srate)
__pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_srate); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 793, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_7 = __pyx_PyFloat_AsDouble(__pyx_t_4); if (unlikely((__pyx_t_7 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 793, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_8 = __pyx_f_8pysndlib_3clm_set_srate(__pyx_t_7, 0); if (unlikely(__pyx_t_8 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 793, __pyx_L1_error)
0794:
0795: # in original why use reverb-1?
+0796: if self.statistics :
__pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_statistics); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 796, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 796, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__pyx_t_3) { /* … */ }
+0797: self.tic = time.perf_counter()
__Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_time); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 797, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_perf_counter); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 797, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = NULL; __pyx_t_9 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_5))) { __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_5); if (likely(__pyx_t_1)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); __Pyx_INCREF(__pyx_t_1); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_5, function); __pyx_t_9 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_1, NULL}; __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_9, 0+__pyx_t_9); __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 797, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_tic, __pyx_t_4) < 0) __PYX_ERR(0, 797, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
0798:
+0799: if self.output_to_file :
__pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_output_to_file); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 799, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 799, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__pyx_t_3) { /* … */ goto __pyx_L13; }
+0800: if self.continue_old_file:
__pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_continue_old_file); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 800, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 800, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__pyx_t_3) { /* … */ goto __pyx_L14; }
+0801: CLM.output = continue_sample2file(self.filename)
__pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_filename); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 801, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (!(likely(PyString_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None) || __Pyx_RaiseUnexpectedTypeError("str", __pyx_t_4))) __PYX_ERR(0, 801, __pyx_L1_error) __pyx_t_5 = ((PyObject *)__pyx_f_8pysndlib_3clm_continue_sample2file(((PyObject*)__pyx_t_4), 0)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 801, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_CLM); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 801, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (__Pyx_PyObject_SetAttrStr(__pyx_t_4, __pyx_n_s_output, __pyx_t_5) < 0) __PYX_ERR(0, 801, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+0802: set_srate(csndlib.mus_sound_srate(self.filename)) # maybe print warning or at least note
__pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_filename); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 802, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_10 = __Pyx_PyObject_AsString(__pyx_t_4); if (unlikely((!__pyx_t_10) && PyErr_Occurred())) __PYX_ERR(0, 802, __pyx_L1_error) __pyx_t_8 = __pyx_f_8pysndlib_3clm_set_srate(mus_sound_srate(__pyx_t_10), 0); if (unlikely(__pyx_t_8 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 802, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
0803: else:
+0804: CLM.output = make_sample2file(self.output,self.channels, sample_type=self.sample_type , header_type=self.header_type)
/*else*/ {
__pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_output); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 804, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
__pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_channels); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 804, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_5);
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_sample_type); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 804, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_header_type); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 804, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_11);
__pyx_t_13.__pyx_n = 3;
__pyx_t_13.chans = __pyx_t_5;
__pyx_t_13.sample_type = __pyx_t_1;
__pyx_t_13.header_type = __pyx_t_11;
__pyx_t_12 = ((PyObject *)__pyx_f_8pysndlib_3clm_make_sample2file(__pyx_t_4, 0, &__pyx_t_13)); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 804, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_12);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
__Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_CLM); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 804, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_11);
if (__Pyx_PyObject_SetAttrStr(__pyx_t_11, __pyx_n_s_output, __pyx_t_12) < 0) __PYX_ERR(0, 804, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
__Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
}
__pyx_L14:;
+0805: elif is_list_or_ndarray(self.output):
__pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_output); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 805, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); __pyx_t_12 = __pyx_f_8pysndlib_3clm_is_list_or_ndarray(__pyx_t_11, 0); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 805, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_12); __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_12); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 805, __pyx_L1_error) __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; if (likely(__pyx_t_3)) { /* … */ goto __pyx_L13; }
+0806: CLM.output = self.output
__pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_output); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 806, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_12); __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_CLM); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 806, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); if (__Pyx_PyObject_SetAttrStr(__pyx_t_11, __pyx_n_s_output, __pyx_t_12) < 0) __PYX_ERR(0, 806, __pyx_L1_error) __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
0807: else:
+0808: raise TypeError(f"writing to {type(self.output)} not supported")
/*else*/ {
__pyx_t_11 = PyTuple_New(3); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 808, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_11);
__pyx_t_14 = 0;
__pyx_t_15 = 127;
__Pyx_INCREF(__pyx_kp_u_writing_to);
__pyx_t_14 += 12;
__Pyx_GIVEREF(__pyx_kp_u_writing_to);
PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_kp_u_writing_to);
__pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_output); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 808, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_12);
__pyx_t_1 = __Pyx_PyObject_FormatSimple(((PyObject *)Py_TYPE(__pyx_t_12)), __pyx_empty_unicode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 808, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
__pyx_t_15 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_1) > __pyx_t_15) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_1) : __pyx_t_15;
__pyx_t_14 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_1);
__Pyx_GIVEREF(__pyx_t_1);
PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_1);
__pyx_t_1 = 0;
__Pyx_INCREF(__pyx_kp_u_not_supported);
__pyx_t_14 += 14;
__Pyx_GIVEREF(__pyx_kp_u_not_supported);
PyTuple_SET_ITEM(__pyx_t_11, 2, __pyx_kp_u_not_supported);
__pyx_t_1 = __Pyx_PyUnicode_Join(__pyx_t_11, 3, __pyx_t_14, __pyx_t_15); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 808, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
__pyx_t_11 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 808, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_11);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_Raise(__pyx_t_11, 0, 0, 0);
__Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
__PYX_ERR(0, 808, __pyx_L1_error)
}
__pyx_L13:;
0809:
+0810: if self.reverb_to_file:
__pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_reverb_to_file); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 810, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_11); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 810, __pyx_L1_error) __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; if (__pyx_t_3) { /* … */ }
+0811: if self.continue_old_file:
__pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_continue_old_file); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 811, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_11); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 811, __pyx_L1_error) __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; if (__pyx_t_3) { /* … */ goto __pyx_L16; }
+0812: CLM.reverb = continue_sample2file(self.revfile)
__pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_revfile); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 812, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); if (!(likely(PyString_CheckExact(__pyx_t_11))||((__pyx_t_11) == Py_None) || __Pyx_RaiseUnexpectedTypeError("str", __pyx_t_11))) __PYX_ERR(0, 812, __pyx_L1_error) __pyx_t_1 = ((PyObject *)__pyx_f_8pysndlib_3clm_continue_sample2file(((PyObject*)__pyx_t_11), 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 812, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_CLM); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 812, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); if (__Pyx_PyObject_SetAttrStr(__pyx_t_11, __pyx_n_s_reverb, __pyx_t_1) < 0) __PYX_ERR(0, 812, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
0813: else:
+0814: CLM.reverb = make_sample2file(self.revfile,self.reverb_channels, sample_type=self.sample_type , header_type=self.header_type)
/*else*/ {
__pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_revfile); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 814, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_11);
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_reverb_channels); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 814, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_sample_type); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 814, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_12);
__pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_header_type); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 814, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_5);
__pyx_t_13.__pyx_n = 3;
__pyx_t_13.chans = __pyx_t_1;
__pyx_t_13.sample_type = __pyx_t_12;
__pyx_t_13.header_type = __pyx_t_5;
__pyx_t_4 = ((PyObject *)__pyx_f_8pysndlib_3clm_make_sample2file(__pyx_t_11, 0, &__pyx_t_13)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 814, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_CLM); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 814, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_5);
if (__Pyx_PyObject_SetAttrStr(__pyx_t_5, __pyx_n_s_reverb, __pyx_t_4) < 0) __PYX_ERR(0, 814, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
}
__pyx_L16:;
0815:
+0816: if self.reverb and not self.reverb_to_file and is_list_or_ndarray(self.output):
__pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_reverb); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 816, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 816, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_6) { } else { __pyx_t_3 = __pyx_t_6; goto __pyx_L18_bool_binop_done; } __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_reverb_to_file); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 816, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 816, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_2 = (!__pyx_t_6); if (__pyx_t_2) { } else { __pyx_t_3 = __pyx_t_2; goto __pyx_L18_bool_binop_done; } __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_output); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 816, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_4 = __pyx_f_8pysndlib_3clm_is_list_or_ndarray(__pyx_t_5, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 816, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 816, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_3 = __pyx_t_2; __pyx_L18_bool_binop_done:; if (__pyx_t_3) { /* … */ }
+0817: CLM.reverb = np.zeros((self.reverb_channels, np.shape(CLM.output)[1]), dtype=CLM.output.dtype)
__Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 817, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_zeros); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 817, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_reverb_channels); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 817, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 817, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_shape); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 817, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_CLM); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 817, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_output); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 817, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_16); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = NULL; __pyx_t_9 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_11))) { __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_11); if (likely(__pyx_t_1)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11); __Pyx_INCREF(__pyx_t_1); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_11, function); __pyx_t_9 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_t_16}; __pyx_t_12 = __Pyx_PyObject_FastCall(__pyx_t_11, __pyx_callargs+1-__pyx_t_9, 1+__pyx_t_9); __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 817, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_12); __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; } __pyx_t_11 = __Pyx_GetItemInt(__pyx_t_12, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 817, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; __pyx_t_12 = PyTuple_New(2); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 817, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_12); __Pyx_GIVEREF(__pyx_t_4); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_4)) __PYX_ERR(0, 817, __pyx_L1_error); __Pyx_GIVEREF(__pyx_t_11); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_12, 1, __pyx_t_11)) __PYX_ERR(0, 817, __pyx_L1_error); __pyx_t_4 = 0; __pyx_t_11 = 0; __pyx_t_11 = PyTuple_New(1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 817, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); __Pyx_GIVEREF(__pyx_t_12); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_12)) __PYX_ERR(0, 817, __pyx_L1_error); __pyx_t_12 = 0; __pyx_t_12 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 817, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_12); __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_CLM); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 817, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_output); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 817, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_16); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_16, __pyx_n_s_dtype); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 817, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; if (PyDict_SetItem(__pyx_t_12, __pyx_n_s_dtype, __pyx_t_4) < 0) __PYX_ERR(0, 817, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_11, __pyx_t_12); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 817, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; __Pyx_GetModuleGlobalName(__pyx_t_12, __pyx_n_s_CLM); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 817, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_12); if (__Pyx_PyObject_SetAttrStr(__pyx_t_12, __pyx_n_s_reverb, __pyx_t_4) < 0) __PYX_ERR(0, 817, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
0818:
+0819: return self
__Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_v_self); __pyx_r = __pyx_v_self; goto __pyx_L0;
0820:
+0821: def __exit__(self, *args):
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_5Sound_5__exit__(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_8pysndlib_3clm_5Sound_5__exit__ = {"__exit__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_5Sound_5__exit__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_8pysndlib_3clm_5Sound_5__exit__(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
PyObject *__pyx_v_self = 0;
CYTHON_UNUSED PyObject *__pyx_v_args = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__exit__ (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
__pyx_v_args = __Pyx_ArgsSlice_FASTCALL(__pyx_args, 1, __pyx_nargs);
if (unlikely(!__pyx_v_args)) {
__Pyx_RefNannyFinishContext();
return NULL;
}
__Pyx_GOTREF(__pyx_v_args);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,0};
PyObject* values[1] = {0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
default:
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_self)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 821, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
const Py_ssize_t used_pos_args = (kwd_pos_args < 1) ? kwd_pos_args : 1;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, used_pos_args, "__exit__") < 0)) __PYX_ERR(0, 821, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs < 1)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
}
__pyx_v_self = values[0];
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("__exit__", 0, 1, 1, __pyx_nargs); __PYX_ERR(0, 821, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_DECREF(__pyx_v_args); __pyx_v_args = 0;
__Pyx_AddTraceback("pysndlib.clm.Sound.__exit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_8pysndlib_3clm_5Sound_4__exit__(__pyx_self, __pyx_v_self, __pyx_v_args);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
__Pyx_DECREF(__pyx_v_args);
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_5Sound_4__exit__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_args) {
__Pyx_memviewslice __pyx_v_vals_view = { 0, 0, { 0 }, { 0 }, { 0 } };
__Pyx_memviewslice __pyx_v_times_view = { 0, 0, { 0 }, { 0 }, { 0 } };
PyObject *__pyx_v_toc = NULL;
PyObject *__pyx_v_statstr = NULL;
long __pyx_v_chans;
PyObject *__pyx_v_vals = NULL;
PyObject *__pyx_v_times = NULL;
CYTHON_UNUSED mus_long_t __pyx_v_maxamp;
long __pyx_v_i;
PyObject *__pyx_v_mabs = NULL;
PyObject *__pyx_v_arr = NULL;
CYTHON_UNUSED PyObject *__pyx_v__ = NULL;
PyObject *__pyx_r = NULL;
/* … */
/* function exit code */
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__PYX_XCLEAR_MEMVIEW(&__pyx_t_1, 1);
__PYX_XCLEAR_MEMVIEW(&__pyx_t_2, 1);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_5);
__Pyx_XDECREF(__pyx_t_7);
__Pyx_XDECREF(__pyx_t_8);
__Pyx_XDECREF(__pyx_t_10);
__Pyx_XDECREF(__pyx_t_21);
__Pyx_XDECREF(__pyx_t_22);
__Pyx_XDECREF(__pyx_t_23);
__Pyx_AddTraceback("pysndlib.clm.Sound.__exit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__PYX_XCLEAR_MEMVIEW(&__pyx_v_vals_view, 1);
__PYX_XCLEAR_MEMVIEW(&__pyx_v_times_view, 1);
__Pyx_XDECREF(__pyx_v_toc);
__Pyx_XDECREF(__pyx_v_statstr);
__Pyx_XDECREF(__pyx_v_vals);
__Pyx_XDECREF(__pyx_v_times);
__Pyx_XDECREF(__pyx_v_mabs);
__Pyx_XDECREF(__pyx_v_arr);
__Pyx_XDECREF(__pyx_v__);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_tuple__149 = PyTuple_Pack(14, __pyx_n_s_self, __pyx_n_s_args, __pyx_n_s_vals_view, __pyx_n_s_times_view, __pyx_n_s_toc, __pyx_n_s_statstr, __pyx_n_s_chans, __pyx_n_s_vals, __pyx_n_s_times, __pyx_n_s_maxamp_3, __pyx_n_s_i, __pyx_n_s_mabs, __pyx_n_s_arr, __pyx_n_s__148); if (unlikely(!__pyx_tuple__149)) __PYX_ERR(0, 821, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__149);
__Pyx_GIVEREF(__pyx_tuple__149);
/* … */
__pyx_t_41 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_5Sound_5__exit__, 0, __pyx_n_s_Sound___exit, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__150)); if (unlikely(!__pyx_t_41)) __PYX_ERR(0, 821, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_41);
if (__Pyx_SetNameInClass(__pyx_t_37, __pyx_n_s_exit, __pyx_t_41) < 0) __PYX_ERR(0, 821, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_41); __pyx_t_41 = 0;
__pyx_codeobj__150 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 14, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_VARARGS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__149, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_exit, 821, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__150)) __PYX_ERR(0, 821, __pyx_L1_error)
+0822: cdef cclm.mus_float_t [:] vals_view = None
__pyx_t_1 = __Pyx_PyObject_to_MemoryviewSlice_ds_nn_mus_float_t(Py_None, PyBUF_WRITABLE); if (unlikely(!__pyx_t_1.memview)) __PYX_ERR(0, 822, __pyx_L1_error) __pyx_v_vals_view = __pyx_t_1; __pyx_t_1.memview = NULL; __pyx_t_1.data = NULL;
+0823: cdef cclm.mus_long_t [:] times_view = None
__pyx_t_2 = __Pyx_PyObject_to_MemoryviewSlice_ds_nn_mus_long_t(Py_None, PyBUF_WRITABLE); if (unlikely(!__pyx_t_2.memview)) __PYX_ERR(0, 823, __pyx_L1_error) __pyx_v_times_view = __pyx_t_2; __pyx_t_2.memview = NULL; __pyx_t_2.data = NULL;
+0824: if self.reverb:
__pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_reverb); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 824, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 824, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_4) { /* … */ }
0825:
+0826: if self.reverb_to_file:
__pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_reverb_to_file); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 826, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 826, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_4) { /* … */ }
+0827: mus_close(CLM.reverb)
__Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_CLM); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 827, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_reverb); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 827, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_8pysndlib_3clm_mus_any))))) __PYX_ERR(0, 827, __pyx_L1_error) __pyx_t_6 = __pyx_f_8pysndlib_3clm_mus_close(((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_t_5), 0); if (unlikely(__pyx_t_6 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 827, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
0828:
+0829: CLM.reverb = make_file2sample(self.revfile)
__pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_revfile); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 829, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_3 = ((PyObject *)__pyx_f_8pysndlib_3clm_make_file2sample(__pyx_t_5, 0, NULL)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 829, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_CLM); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 829, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); if (__Pyx_PyObject_SetAttrStr(__pyx_t_5, __pyx_n_s_reverb, __pyx_t_3) < 0) __PYX_ERR(0, 829, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
0830:
+0831: if isinstance(self.reverb, functools.partial):
__pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_reverb); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 831, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_functools); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 831, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_partial); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 831, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_4 = PyObject_IsInstance(__pyx_t_5, __pyx_t_7); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 831, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; if (__pyx_t_4) { /* … */ goto __pyx_L5; }
+0832: self.reverb() ## reverb_data will be ignored in this case
__pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_reverb); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 832, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_3 = NULL; __pyx_t_6 = 0; #if CYTHON_UNPACK_METHODS if (likely(PyMethod_Check(__pyx_t_5))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_5, function); __pyx_t_6 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL}; __pyx_t_7 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_6, 0+__pyx_t_6); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 832, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
0833: else:
+0834: if self.reverb_data:
/*else*/ {
__pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_reverb_data); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 834, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_7);
__pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 834, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
if (__pyx_t_4) {
/* … */
goto __pyx_L6;
}
+0835: self.reverb()(**self.reverb_data)
__pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_reverb); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 835, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_3 = NULL; __pyx_t_6 = 0; #if CYTHON_UNPACK_METHODS if (likely(PyMethod_Check(__pyx_t_5))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_5, function); __pyx_t_6 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL}; __pyx_t_7 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_6, 0+__pyx_t_6); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 835, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_reverb_data); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 835, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); if (unlikely(__pyx_t_3 == Py_None)) { PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType"); __PYX_ERR(0, 835, __pyx_L1_error) } if (likely(PyDict_CheckExact(__pyx_t_3))) { __pyx_t_5 = PyDict_Copy(__pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 835, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } else { __pyx_t_5 = __Pyx_PyObject_CallOneArg((PyObject*)&PyDict_Type, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 835, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_empty_tuple, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 835, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
0836: else:
+0837: self.reverb()()
/*else*/ {
__pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_reverb); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 837, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_7);
__pyx_t_8 = NULL;
__pyx_t_6 = 0;
#if CYTHON_UNPACK_METHODS
if (likely(PyMethod_Check(__pyx_t_7))) {
__pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
if (likely(__pyx_t_8)) {
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
__Pyx_INCREF(__pyx_t_8);
__Pyx_INCREF(function);
__Pyx_DECREF_SET(__pyx_t_7, function);
__pyx_t_6 = 1;
}
}
#endif
{
PyObject *__pyx_callargs[2] = {__pyx_t_8, NULL};
__pyx_t_5 = __Pyx_PyObject_FastCall(__pyx_t_7, __pyx_callargs+1-__pyx_t_6, 0+__pyx_t_6);
__Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 837, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
}
__pyx_t_7 = NULL;
__pyx_t_6 = 0;
#if CYTHON_UNPACK_METHODS
if (unlikely(PyMethod_Check(__pyx_t_5))) {
__pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5);
if (likely(__pyx_t_7)) {
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
__Pyx_INCREF(__pyx_t_7);
__Pyx_INCREF(function);
__Pyx_DECREF_SET(__pyx_t_5, function);
__pyx_t_6 = 1;
}
}
#endif
{
PyObject *__pyx_callargs[2] = {__pyx_t_7, NULL};
__pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_6, 0+__pyx_t_6);
__Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 837, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
}
__pyx_L6:;
}
__pyx_L5:;
0838:
+0839: mus_close(CLM.reverb)
__Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_CLM); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 839, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_reverb); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 839, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_8pysndlib_3clm_mus_any))))) __PYX_ERR(0, 839, __pyx_L1_error) __pyx_t_6 = __pyx_f_8pysndlib_3clm_mus_close(((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_t_5), 0); if (unlikely(__pyx_t_6 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 839, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
0840:
+0841: if is_list_or_ndarray(CLM.reverb):
__Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_CLM); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 841, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_reverb); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 841, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_5 = __pyx_f_8pysndlib_3clm_is_list_or_ndarray(__pyx_t_3, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 841, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 841, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_4) { /* … */ }
+0842: if isinstance(self.reverb, functools.partial):
__pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_reverb); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 842, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_functools); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 842, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_partial); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 842, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_4 = PyObject_IsInstance(__pyx_t_5, __pyx_t_7); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 842, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; if (__pyx_t_4) { /* … */ goto __pyx_L8; }
+0843: self.reverb() ## reverb_data will be ignored in this case
__pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_reverb); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 843, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_3 = NULL; __pyx_t_6 = 0; #if CYTHON_UNPACK_METHODS if (likely(PyMethod_Check(__pyx_t_5))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_5, function); __pyx_t_6 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL}; __pyx_t_7 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_6, 0+__pyx_t_6); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 843, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
0844: else:
+0845: if self.reverb_data:
/*else*/ {
__pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_reverb_data); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 845, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_7);
__pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 845, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
if (__pyx_t_4) {
/* … */
goto __pyx_L9;
}
+0846: self.reverb()(**self.reverb_data)
__pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_reverb); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 846, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_3 = NULL; __pyx_t_6 = 0; #if CYTHON_UNPACK_METHODS if (likely(PyMethod_Check(__pyx_t_5))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_5, function); __pyx_t_6 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL}; __pyx_t_7 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_6, 0+__pyx_t_6); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 846, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_reverb_data); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 846, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); if (unlikely(__pyx_t_3 == Py_None)) { PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType"); __PYX_ERR(0, 846, __pyx_L1_error) } if (likely(PyDict_CheckExact(__pyx_t_3))) { __pyx_t_5 = PyDict_Copy(__pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 846, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } else { __pyx_t_5 = __Pyx_PyObject_CallOneArg((PyObject*)&PyDict_Type, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 846, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_empty_tuple, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 846, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
0847: else:
+0848: self.reverb()()
/*else*/ {
__pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_reverb); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 848, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_7);
__pyx_t_8 = NULL;
__pyx_t_6 = 0;
#if CYTHON_UNPACK_METHODS
if (likely(PyMethod_Check(__pyx_t_7))) {
__pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
if (likely(__pyx_t_8)) {
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
__Pyx_INCREF(__pyx_t_8);
__Pyx_INCREF(function);
__Pyx_DECREF_SET(__pyx_t_7, function);
__pyx_t_6 = 1;
}
}
#endif
{
PyObject *__pyx_callargs[2] = {__pyx_t_8, NULL};
__pyx_t_5 = __Pyx_PyObject_FastCall(__pyx_t_7, __pyx_callargs+1-__pyx_t_6, 0+__pyx_t_6);
__Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 848, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
}
__pyx_t_7 = NULL;
__pyx_t_6 = 0;
#if CYTHON_UNPACK_METHODS
if (unlikely(PyMethod_Check(__pyx_t_5))) {
__pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5);
if (likely(__pyx_t_7)) {
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
__Pyx_INCREF(__pyx_t_7);
__Pyx_INCREF(function);
__Pyx_DECREF_SET(__pyx_t_5, function);
__pyx_t_6 = 1;
}
}
#endif
{
PyObject *__pyx_callargs[2] = {__pyx_t_7, NULL};
__pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_6, 0+__pyx_t_6);
__Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 848, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
}
__pyx_L9:;
}
__pyx_L8:;
0849:
+0850: if self.output_to_file:
__pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_output_to_file); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 850, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 850, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_4) { /* … */ }
+0851: mus_close(CLM.output)
__Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_CLM); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 851, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_output); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 851, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_8pysndlib_3clm_mus_any))))) __PYX_ERR(0, 851, __pyx_L1_error) __pyx_t_6 = __pyx_f_8pysndlib_3clm_mus_close(((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_t_5), 0); if (unlikely(__pyx_t_6 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 851, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
0852:
0853:
+0854: if self.statistics :
__pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_statistics); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 854, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 854, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_4) { /* … */ }
+0855: toc = time.perf_counter()
__Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_time); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 855, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_perf_counter); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 855, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = NULL; __pyx_t_6 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_7))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_7); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_7, function); __pyx_t_6 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL}; __pyx_t_5 = __Pyx_PyObject_FastCall(__pyx_t_7, __pyx_callargs+1-__pyx_t_6, 0+__pyx_t_6); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 855, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; } __pyx_v_toc = __pyx_t_5; __pyx_t_5 = 0;
0856:
+0857: statstr = ''
__Pyx_INCREF(__pyx_kp_s_);
__pyx_v_statstr = __pyx_kp_s_;
+0858: if isinstance(self.output, str):
__pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_output); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 858, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_4 = PyString_Check(__pyx_t_5); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_4) { /* … */ }
+0859: statstr = f"{self.output}: "
__pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_output); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 859, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_7 = __Pyx_PyObject_FormatSimple(__pyx_t_5, __pyx_empty_unicode); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 859, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_5 = __Pyx_PyUnicode_ConcatInPlace(__pyx_t_7, __pyx_kp_u__4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 859, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF_SET(__pyx_v_statstr, __pyx_t_5); __pyx_t_5 = 0;
+0860: if self.output_to_file:
__pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_output_to_file); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 860, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 860, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_4) { /* … */ goto __pyx_L13; }
+0861: chans = clm_channels(self.output)
__pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_output); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 861, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_9 = __pyx_f_8pysndlib_3clm_clm_channels(__pyx_t_5, 0); if (unlikely(__pyx_t_9 == ((long)-1) && PyErr_Occurred())) __PYX_ERR(0, 861, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_v_chans = __pyx_t_9;
+0862: vals = np.zeros(chans, dtype=np.double)
__Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 862, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_zeros); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 862, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_5 = __Pyx_PyInt_From_long(__pyx_v_chans); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 862, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 862, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_GIVEREF(__pyx_t_5); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5)) __PYX_ERR(0, 862, __pyx_L1_error); __pyx_t_5 = 0; __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 862, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 862, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_double); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 862, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_dtype, __pyx_t_10) < 0) __PYX_ERR(0, 862, __pyx_L1_error) __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 862, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_v_vals = __pyx_t_10; __pyx_t_10 = 0;
+0863: times = np.zeros(chans, dtype=np.int64)
__Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_np); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 863, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_zeros); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 863, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __pyx_t_10 = __Pyx_PyInt_From_long(__pyx_v_chans); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 863, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 863, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_GIVEREF(__pyx_t_10); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_10)) __PYX_ERR(0, 863, __pyx_L1_error); __pyx_t_10 = 0; __pyx_t_10 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 863, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 863, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_int64); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 863, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; if (PyDict_SetItem(__pyx_t_10, __pyx_n_s_dtype, __pyx_t_8) < 0) __PYX_ERR(0, 863, __pyx_L1_error) __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_3, __pyx_t_10); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 863, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __pyx_v_times = __pyx_t_8; __pyx_t_8 = 0;
+0864: vals_view = vals
__pyx_t_1 = __Pyx_PyObject_to_MemoryviewSlice_ds_nn_mus_float_t(__pyx_v_vals, PyBUF_WRITABLE); if (unlikely(!__pyx_t_1.memview)) __PYX_ERR(0, 864, __pyx_L1_error) __PYX_XCLEAR_MEMVIEW(&__pyx_v_vals_view, 1); __pyx_v_vals_view = __pyx_t_1; __pyx_t_1.memview = NULL; __pyx_t_1.data = NULL;
+0865: times_view = times
__pyx_t_2 = __Pyx_PyObject_to_MemoryviewSlice_ds_nn_mus_long_t(__pyx_v_times, PyBUF_WRITABLE); if (unlikely(!__pyx_t_2.memview)) __PYX_ERR(0, 865, __pyx_L1_error) __PYX_XCLEAR_MEMVIEW(&__pyx_v_times_view, 1); __pyx_v_times_view = __pyx_t_2; __pyx_t_2.memview = NULL; __pyx_t_2.data = NULL;
+0866: maxamp = csndlib.mus_sound_maxamps(self.output, chans, &vals_view[0], ×_view[0])
__pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_output); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 866, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __pyx_t_11 = __Pyx_PyObject_AsString(__pyx_t_8); if (unlikely((!__pyx_t_11) && PyErr_Occurred())) __PYX_ERR(0, 866, __pyx_L1_error) __pyx_t_12 = 0; __pyx_t_6 = -1; if (__pyx_t_12 < 0) { __pyx_t_12 += __pyx_v_vals_view.shape[0]; if (unlikely(__pyx_t_12 < 0)) __pyx_t_6 = 0; } else if (unlikely(__pyx_t_12 >= __pyx_v_vals_view.shape[0])) __pyx_t_6 = 0; if (unlikely(__pyx_t_6 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_6); __PYX_ERR(0, 866, __pyx_L1_error) } __pyx_t_13 = 0; __pyx_t_6 = -1; if (__pyx_t_13 < 0) { __pyx_t_13 += __pyx_v_times_view.shape[0]; if (unlikely(__pyx_t_13 < 0)) __pyx_t_6 = 0; } else if (unlikely(__pyx_t_13 >= __pyx_v_times_view.shape[0])) __pyx_t_6 = 0; if (unlikely(__pyx_t_6 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_6); __PYX_ERR(0, 866, __pyx_L1_error) } __pyx_v_maxamp = mus_sound_maxamps(__pyx_t_11, __pyx_v_chans, (&(*((mus_float_t *) ( /* dim=0 */ (__pyx_v_vals_view.data + __pyx_t_12 * __pyx_v_vals_view.strides[0]) )))), (&(*((mus_long_t *) ( /* dim=0 */ (__pyx_v_times_view.data + __pyx_t_13 * __pyx_v_times_view.strides[0]) ))))); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+0867: statstr += f": maxamp: {vals} {times} "
__pyx_t_8 = PyTuple_New(5); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 867, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __pyx_t_14 = 0; __pyx_t_15 = 127; __Pyx_INCREF(__pyx_kp_u_maxamp); __pyx_t_14 += 10; __Pyx_GIVEREF(__pyx_kp_u_maxamp); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_kp_u_maxamp); __pyx_t_10 = __Pyx_PyObject_FormatSimple(__pyx_v_vals, __pyx_empty_unicode); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 867, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __pyx_t_15 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_10) > __pyx_t_15) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_10) : __pyx_t_15; __pyx_t_14 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_10); __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_10); __pyx_t_10 = 0; __Pyx_INCREF(__pyx_kp_u__17); __pyx_t_14 += 1; __Pyx_GIVEREF(__pyx_kp_u__17); PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_kp_u__17); __pyx_t_10 = __Pyx_PyObject_FormatSimple(__pyx_v_times, __pyx_empty_unicode); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 867, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __pyx_t_15 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_10) > __pyx_t_15) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_10) : __pyx_t_15; __pyx_t_14 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_10); __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_8, 3, __pyx_t_10); __pyx_t_10 = 0; __Pyx_INCREF(__pyx_kp_u__17); __pyx_t_14 += 1; __Pyx_GIVEREF(__pyx_kp_u__17); PyTuple_SET_ITEM(__pyx_t_8, 4, __pyx_kp_u__17); __pyx_t_10 = __Pyx_PyUnicode_Join(__pyx_t_8, 5, __pyx_t_14, __pyx_t_15); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 867, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __pyx_t_8 = PyNumber_InPlaceAdd(__pyx_v_statstr, __pyx_t_10); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 867, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __Pyx_DECREF_SET(__pyx_v_statstr, __pyx_t_8); __pyx_t_8 = 0;
0868: else:
+0869: chans = clm_channels(self.output)
/*else*/ {
__pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_output); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 869, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_8);
__pyx_t_9 = __pyx_f_8pysndlib_3clm_clm_channels(__pyx_t_8, 0); if (unlikely(__pyx_t_9 == ((long)-1) && PyErr_Occurred())) __PYX_ERR(0, 869, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
__pyx_v_chans = __pyx_t_9;
+0870: vals = np.zeros(chans, dtype=np.double)
__Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 870, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_zeros); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 870, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __pyx_t_8 = __Pyx_PyInt_From_long(__pyx_v_chans); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 870, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 870, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_GIVEREF(__pyx_t_8); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_8)) __PYX_ERR(0, 870, __pyx_L1_error); __pyx_t_8 = 0; __pyx_t_8 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 870, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 870, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_double); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 870, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_dtype, __pyx_t_7) < 0) __PYX_ERR(0, 870, __pyx_L1_error) __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_3, __pyx_t_8); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 870, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __pyx_v_vals = __pyx_t_7; __pyx_t_7 = 0;
+0871: times = np.zeros(chans, dtype=np.int64)
__Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 871, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_zeros); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 871, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_7 = __Pyx_PyInt_From_long(__pyx_v_chans); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 871, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 871, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_GIVEREF(__pyx_t_7); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_7)) __PYX_ERR(0, 871, __pyx_L1_error); __pyx_t_7 = 0; __pyx_t_7 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 871, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_np); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 871, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_int64); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 871, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_dtype, __pyx_t_5) < 0) __PYX_ERR(0, 871, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_3, __pyx_t_7); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 871, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_v_times = __pyx_t_5; __pyx_t_5 = 0;
+0872: for i in range(chans):
__pyx_t_9 = __pyx_v_chans;
__pyx_t_16 = __pyx_t_9;
for (__pyx_t_17 = 0; __pyx_t_17 < __pyx_t_16; __pyx_t_17+=1) {
__pyx_v_i = __pyx_t_17;
+0873: mabs = np.abs(self.output[i])
__Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 873, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_abs); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 873, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_output); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 873, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_8 = __Pyx_GetItemInt(__pyx_t_7, __pyx_v_i, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 873, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_7 = NULL; __pyx_t_6 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_3))) { __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_7)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_7); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); __pyx_t_6 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_t_8}; __pyx_t_5 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6); __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 873, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } __Pyx_XDECREF_SET(__pyx_v_mabs, __pyx_t_5); __pyx_t_5 = 0;
+0874: vals[i] = np.amax(mabs)
__Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 874, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_amax); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 874, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = NULL; __pyx_t_6 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_8))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_8); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_8, function); __pyx_t_6 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v_mabs}; __pyx_t_5 = __Pyx_PyObject_FastCall(__pyx_t_8, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 874, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; } if (unlikely((__Pyx_SetItemInt(__pyx_v_vals, __pyx_v_i, __pyx_t_5, long, 1, __Pyx_PyInt_From_long, 0, 1, 1) < 0))) __PYX_ERR(0, 874, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+0875: times[i] = np.argmax(mabs)
__Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 875, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_argmax); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 875, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __pyx_t_8 = NULL; __pyx_t_6 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_3))) { __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_8)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_8); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); __pyx_t_6 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_8, __pyx_v_mabs}; __pyx_t_5 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6); __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 875, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } if (unlikely((__Pyx_SetItemInt(__pyx_v_times, __pyx_v_i, __pyx_t_5, long, 1, __Pyx_PyInt_From_long, 0, 1, 1) < 0))) __PYX_ERR(0, 875, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; }
+0876: statstr += f"maxamp: {vals} {times} "
__pyx_t_5 = PyTuple_New(5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 876, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_14 = 0; __pyx_t_15 = 127; __Pyx_INCREF(__pyx_kp_u_maxamp_2); __pyx_t_14 += 8; __Pyx_GIVEREF(__pyx_kp_u_maxamp_2); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_kp_u_maxamp_2); __pyx_t_3 = __Pyx_PyObject_FormatSimple(__pyx_v_vals, __pyx_empty_unicode); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 876, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_15 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3) > __pyx_t_15) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3) : __pyx_t_15; __pyx_t_14 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_3); __pyx_t_3 = 0; __Pyx_INCREF(__pyx_kp_u__17); __pyx_t_14 += 1; __Pyx_GIVEREF(__pyx_kp_u__17); PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_kp_u__17); __pyx_t_3 = __Pyx_PyObject_FormatSimple(__pyx_v_times, __pyx_empty_unicode); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 876, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_15 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3) > __pyx_t_15) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3) : __pyx_t_15; __pyx_t_14 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_t_3); __pyx_t_3 = 0; __Pyx_INCREF(__pyx_kp_u__17); __pyx_t_14 += 1; __Pyx_GIVEREF(__pyx_kp_u__17); PyTuple_SET_ITEM(__pyx_t_5, 4, __pyx_kp_u__17); __pyx_t_3 = __Pyx_PyUnicode_Join(__pyx_t_5, 5, __pyx_t_14, __pyx_t_15); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 876, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_5 = PyNumber_InPlaceAdd(__pyx_v_statstr, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 876, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF_SET(__pyx_v_statstr, __pyx_t_5); __pyx_t_5 = 0; } __pyx_L13:;
0877:
0878:
+0879: if self.scaled_by or self.scaled_to:
__pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_scaled_by); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 879, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_18 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely((__pyx_t_18 < 0))) __PYX_ERR(0, 879, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (!__pyx_t_18) { } else { __pyx_t_4 = __pyx_t_18; goto __pyx_L17_bool_binop_done; } __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_scaled_to); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 879, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_18 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely((__pyx_t_18 < 0))) __PYX_ERR(0, 879, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_4 = __pyx_t_18; __pyx_L17_bool_binop_done:; if (__pyx_t_4) { /* … */ }
+0880: statstr += "(before scaling) "
__pyx_t_5 = PyNumber_InPlaceAdd(__pyx_v_statstr, __pyx_kp_s_before_scaling); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 880, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF_SET(__pyx_v_statstr, __pyx_t_5); __pyx_t_5 = 0;
0881:
+0882: statstr += f"compute time: {toc - self.tic:0.8f} seconds. "
__pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 882, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_14 = 0; __pyx_t_15 = 127; __Pyx_INCREF(__pyx_kp_u_compute_time); __pyx_t_14 += 14; __Pyx_GIVEREF(__pyx_kp_u_compute_time); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_kp_u_compute_time); __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_tic); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 882, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_8 = PyNumber_Subtract(__pyx_v_toc, __pyx_t_3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 882, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = __Pyx_PyObject_Format(__pyx_t_8, __pyx_kp_u_0_8f); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 882, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __pyx_t_15 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3) > __pyx_t_15) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3) : __pyx_t_15; __pyx_t_14 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_3); __pyx_t_3 = 0; __Pyx_INCREF(__pyx_kp_u_seconds); __pyx_t_14 += 10; __Pyx_GIVEREF(__pyx_kp_u_seconds); PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_kp_u_seconds); __pyx_t_3 = __Pyx_PyUnicode_Join(__pyx_t_5, 3, __pyx_t_14, __pyx_t_15); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 882, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_5 = PyNumber_InPlaceAdd(__pyx_v_statstr, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 882, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF_SET(__pyx_v_statstr, __pyx_t_5); __pyx_t_5 = 0;
0883:
0884:
+0885: if self.reverb_to_file:
__pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_reverb_to_file); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 885, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 885, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_4) { /* … */ goto __pyx_L19; }
+0886: chans = clm_channels(self.revfile)
__pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_revfile); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 886, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_9 = __pyx_f_8pysndlib_3clm_clm_channels(__pyx_t_5, 0); if (unlikely(__pyx_t_9 == ((long)-1) && PyErr_Occurred())) __PYX_ERR(0, 886, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_v_chans = __pyx_t_9;
+0887: vals = np.zeros(chans, dtype=np.double)
__Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 887, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 887, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_5 = __Pyx_PyInt_From_long(__pyx_v_chans); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 887, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 887, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_GIVEREF(__pyx_t_5); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_5)) __PYX_ERR(0, 887, __pyx_L1_error); __pyx_t_5 = 0; __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 887, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 887, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_double); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 887, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_dtype, __pyx_t_10) < 0) __PYX_ERR(0, 887, __pyx_L1_error) __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_8, __pyx_t_5); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 887, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF_SET(__pyx_v_vals, __pyx_t_10); __pyx_t_10 = 0;
+0888: times = np.zeros(chans, dtype=np.int_)
__Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_np); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 888, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_zeros); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 888, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __pyx_t_10 = __Pyx_PyInt_From_long(__pyx_v_chans); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 888, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 888, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_GIVEREF(__pyx_t_10); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_10)) __PYX_ERR(0, 888, __pyx_L1_error); __pyx_t_10 = 0; __pyx_t_10 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 888, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 888, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_int); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 888, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (PyDict_SetItem(__pyx_t_10, __pyx_n_s_dtype, __pyx_t_7) < 0) __PYX_ERR(0, 888, __pyx_L1_error) __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_8, __pyx_t_10); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 888, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __Pyx_DECREF_SET(__pyx_v_times, __pyx_t_7); __pyx_t_7 = 0;
+0889: vals_view = vals
__pyx_t_1 = __Pyx_PyObject_to_MemoryviewSlice_ds_nn_mus_float_t(__pyx_v_vals, PyBUF_WRITABLE); if (unlikely(!__pyx_t_1.memview)) __PYX_ERR(0, 889, __pyx_L1_error) __PYX_XCLEAR_MEMVIEW(&__pyx_v_vals_view, 1); __pyx_v_vals_view = __pyx_t_1; __pyx_t_1.memview = NULL; __pyx_t_1.data = NULL;
+0890: times_view = times
__pyx_t_2 = __Pyx_PyObject_to_MemoryviewSlice_ds_nn_mus_long_t(__pyx_v_times, PyBUF_WRITABLE); if (unlikely(!__pyx_t_2.memview)) __PYX_ERR(0, 890, __pyx_L1_error) __PYX_XCLEAR_MEMVIEW(&__pyx_v_times_view, 1); __pyx_v_times_view = __pyx_t_2; __pyx_t_2.memview = NULL; __pyx_t_2.data = NULL;
+0891: maxamp = csndlib.mus_sound_maxamps(self.revfile, chans, &vals_view[0], ×_view[0])
__pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_revfile); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 891, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_11 = __Pyx_PyObject_AsString(__pyx_t_7); if (unlikely((!__pyx_t_11) && PyErr_Occurred())) __PYX_ERR(0, 891, __pyx_L1_error) __pyx_t_13 = 0; __pyx_t_6 = -1; if (__pyx_t_13 < 0) { __pyx_t_13 += __pyx_v_vals_view.shape[0]; if (unlikely(__pyx_t_13 < 0)) __pyx_t_6 = 0; } else if (unlikely(__pyx_t_13 >= __pyx_v_vals_view.shape[0])) __pyx_t_6 = 0; if (unlikely(__pyx_t_6 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_6); __PYX_ERR(0, 891, __pyx_L1_error) } __pyx_t_12 = 0; __pyx_t_6 = -1; if (__pyx_t_12 < 0) { __pyx_t_12 += __pyx_v_times_view.shape[0]; if (unlikely(__pyx_t_12 < 0)) __pyx_t_6 = 0; } else if (unlikely(__pyx_t_12 >= __pyx_v_times_view.shape[0])) __pyx_t_6 = 0; if (unlikely(__pyx_t_6 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_6); __PYX_ERR(0, 891, __pyx_L1_error) } __pyx_v_maxamp = mus_sound_maxamps(__pyx_t_11, __pyx_v_chans, (&(*((mus_float_t *) ( /* dim=0 */ (__pyx_v_vals_view.data + __pyx_t_13 * __pyx_v_vals_view.strides[0]) )))), (&(*((mus_long_t *) ( /* dim=0 */ (__pyx_v_times_view.data + __pyx_t_12 * __pyx_v_times_view.strides[0]) ))))); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+0892: statstr += f"revmax: {vals} {times}"
__pyx_t_7 = PyTuple_New(4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 892, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_14 = 0; __pyx_t_15 = 127; __Pyx_INCREF(__pyx_kp_u_revmax); __pyx_t_14 += 8; __Pyx_GIVEREF(__pyx_kp_u_revmax); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_kp_u_revmax); __pyx_t_10 = __Pyx_PyObject_FormatSimple(__pyx_v_vals, __pyx_empty_unicode); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 892, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __pyx_t_15 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_10) > __pyx_t_15) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_10) : __pyx_t_15; __pyx_t_14 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_10); __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_10); __pyx_t_10 = 0; __Pyx_INCREF(__pyx_kp_u__17); __pyx_t_14 += 1; __Pyx_GIVEREF(__pyx_kp_u__17); PyTuple_SET_ITEM(__pyx_t_7, 2, __pyx_kp_u__17); __pyx_t_10 = __Pyx_PyObject_FormatSimple(__pyx_v_times, __pyx_empty_unicode); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 892, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __pyx_t_15 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_10) > __pyx_t_15) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_10) : __pyx_t_15; __pyx_t_14 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_10); __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_7, 3, __pyx_t_10); __pyx_t_10 = 0; __pyx_t_10 = __Pyx_PyUnicode_Join(__pyx_t_7, 4, __pyx_t_14, __pyx_t_15); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 892, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_7 = PyNumber_InPlaceAdd(__pyx_v_statstr, __pyx_t_10); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 892, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __Pyx_DECREF_SET(__pyx_v_statstr, __pyx_t_7); __pyx_t_7 = 0;
+0893: elif self.reverb and not self.reverb_to_file and is_list_or_ndarray(self.output):
__pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_reverb); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 893, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_18 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely((__pyx_t_18 < 0))) __PYX_ERR(0, 893, __pyx_L1_error) __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; if (__pyx_t_18) { } else { __pyx_t_4 = __pyx_t_18; goto __pyx_L20_bool_binop_done; } __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_reverb_to_file); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 893, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_18 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely((__pyx_t_18 < 0))) __PYX_ERR(0, 893, __pyx_L1_error) __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_19 = (!__pyx_t_18); if (__pyx_t_19) { } else { __pyx_t_4 = __pyx_t_19; goto __pyx_L20_bool_binop_done; } __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_output); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 893, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_10 = __pyx_f_8pysndlib_3clm_is_list_or_ndarray(__pyx_t_7, 0); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 893, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_19 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely((__pyx_t_19 < 0))) __PYX_ERR(0, 893, __pyx_L1_error) __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __pyx_t_4 = __pyx_t_19; __pyx_L20_bool_binop_done:; if (__pyx_t_4) { /* … */ } __pyx_L19:;
+0894: chans = clm_channels(CLM.reverb)
__Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_CLM); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 894, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_reverb); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 894, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __pyx_t_9 = __pyx_f_8pysndlib_3clm_clm_channels(__pyx_t_7, 0); if (unlikely(__pyx_t_9 == ((long)-1) && PyErr_Occurred())) __PYX_ERR(0, 894, __pyx_L1_error) __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_v_chans = __pyx_t_9;
0895:
+0896: vals = np.zeros(chans, dtype=np.double)
__Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 896, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_zeros); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 896, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_7 = __Pyx_PyInt_From_long(__pyx_v_chans); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 896, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 896, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_GIVEREF(__pyx_t_7); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_7)) __PYX_ERR(0, 896, __pyx_L1_error); __pyx_t_7 = 0; __pyx_t_7 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 896, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 896, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_double); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 896, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_dtype, __pyx_t_3) < 0) __PYX_ERR(0, 896, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_8, __pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 896, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF_SET(__pyx_v_vals, __pyx_t_3); __pyx_t_3 = 0;
+0897: times = np.zeros(chans, dtype=np.int_)
__Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 897, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 897, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = __Pyx_PyInt_From_long(__pyx_v_chans); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 897, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 897, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_GIVEREF(__pyx_t_3); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_3)) __PYX_ERR(0, 897, __pyx_L1_error); __pyx_t_3 = 0; __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 897, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_np); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 897, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_int); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 897, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_dtype, __pyx_t_5) < 0) __PYX_ERR(0, 897, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_8, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 897, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF_SET(__pyx_v_times, __pyx_t_5); __pyx_t_5 = 0;
+0898: for i in range(chans):
__pyx_t_9 = __pyx_v_chans;
__pyx_t_16 = __pyx_t_9;
for (__pyx_t_17 = 0; __pyx_t_17 < __pyx_t_16; __pyx_t_17+=1) {
__pyx_v_i = __pyx_t_17;
+0899: mabs = np.abs(CLM.reverb[i])
__Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 899, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_abs); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 899, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_CLM); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 899, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_reverb); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 899, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_7, __pyx_v_i, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 899, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_7 = NULL; __pyx_t_6 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_8))) { __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_8); if (likely(__pyx_t_7)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8); __Pyx_INCREF(__pyx_t_7); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_8, function); __pyx_t_6 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_t_3}; __pyx_t_5 = __Pyx_PyObject_FastCall(__pyx_t_8, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6); __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 899, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; } __Pyx_XDECREF_SET(__pyx_v_mabs, __pyx_t_5); __pyx_t_5 = 0;
+0900: vals[i] = np.amax(mabs)
__Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 900, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_amax); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 900, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __pyx_t_8 = NULL; __pyx_t_6 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_3))) { __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_8)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_8); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); __pyx_t_6 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_8, __pyx_v_mabs}; __pyx_t_5 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6); __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 900, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } if (unlikely((__Pyx_SetItemInt(__pyx_v_vals, __pyx_v_i, __pyx_t_5, long, 1, __Pyx_PyInt_From_long, 0, 1, 1) < 0))) __PYX_ERR(0, 900, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+0901: times[i] = np.argmax(mabs)
__Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 901, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_argmax); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 901, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = NULL; __pyx_t_6 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_8))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_8); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_8, function); __pyx_t_6 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v_mabs}; __pyx_t_5 = __Pyx_PyObject_FastCall(__pyx_t_8, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 901, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; } if (unlikely((__Pyx_SetItemInt(__pyx_v_times, __pyx_v_i, __pyx_t_5, long, 1, __Pyx_PyInt_From_long, 0, 1, 1) < 0))) __PYX_ERR(0, 901, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; }
+0902: statstr += f"revmax: {vals} {times}"
__pyx_t_5 = PyTuple_New(4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 902, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_14 = 0; __pyx_t_15 = 127; __Pyx_INCREF(__pyx_kp_u_revmax); __pyx_t_14 += 8; __Pyx_GIVEREF(__pyx_kp_u_revmax); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_kp_u_revmax); __pyx_t_8 = __Pyx_PyObject_FormatSimple(__pyx_v_vals, __pyx_empty_unicode); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 902, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __pyx_t_15 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_8) > __pyx_t_15) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_8) : __pyx_t_15; __pyx_t_14 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_8); __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_8); __pyx_t_8 = 0; __Pyx_INCREF(__pyx_kp_u__17); __pyx_t_14 += 1; __Pyx_GIVEREF(__pyx_kp_u__17); PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_kp_u__17); __pyx_t_8 = __Pyx_PyObject_FormatSimple(__pyx_v_times, __pyx_empty_unicode); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 902, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __pyx_t_15 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_8) > __pyx_t_15) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_8) : __pyx_t_15; __pyx_t_14 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_8); __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_t_8); __pyx_t_8 = 0; __pyx_t_8 = __Pyx_PyUnicode_Join(__pyx_t_5, 4, __pyx_t_14, __pyx_t_15); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 902, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_5 = PyNumber_InPlaceAdd(__pyx_v_statstr, __pyx_t_8); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 902, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_DECREF_SET(__pyx_v_statstr, __pyx_t_5); __pyx_t_5 = 0;
0903:
+0904: print(statstr)
__pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_builtin_print, __pyx_v_statstr); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 904, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
0905:
+0906: if self.scaled_to:
__pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_scaled_to); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 906, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 906, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_4) { /* … */ goto __pyx_L25; }
+0907: if self.output_to_file:
__pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_output_to_file); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 907, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 907, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_4) { /* … */ goto __pyx_L26; }
+0908: arr, _ = file2ndarray(self.output)
__Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_file2ndarray_2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 908, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_output); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 908, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_7 = NULL; __pyx_t_6 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_8))) { __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_8); if (likely(__pyx_t_7)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8); __Pyx_INCREF(__pyx_t_7); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_8, function); __pyx_t_6 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_t_3}; __pyx_t_5 = __Pyx_PyObject_FastCall(__pyx_t_8, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6); __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 908, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; } if ((likely(PyTuple_CheckExact(__pyx_t_5))) || (PyList_CheckExact(__pyx_t_5))) { PyObject* sequence = __pyx_t_5; Py_ssize_t size = __Pyx_PySequence_SIZE(sequence); if (unlikely(size != 2)) { if (size > 2) __Pyx_RaiseTooManyValuesError(2); else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); __PYX_ERR(0, 908, __pyx_L1_error) } #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS if (likely(PyTuple_CheckExact(sequence))) { __pyx_t_8 = PyTuple_GET_ITEM(sequence, 0); __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); } else { __pyx_t_8 = PyList_GET_ITEM(sequence, 0); __pyx_t_3 = PyList_GET_ITEM(sequence, 1); } __Pyx_INCREF(__pyx_t_8); __Pyx_INCREF(__pyx_t_3); #else __pyx_t_8 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 908, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 908, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); #endif __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } else { Py_ssize_t index = -1; __pyx_t_7 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 908, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_20 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_7); index = 0; __pyx_t_8 = __pyx_t_20(__pyx_t_7); if (unlikely(!__pyx_t_8)) goto __pyx_L27_unpacking_failed; __Pyx_GOTREF(__pyx_t_8); index = 1; __pyx_t_3 = __pyx_t_20(__pyx_t_7); if (unlikely(!__pyx_t_3)) goto __pyx_L27_unpacking_failed; __Pyx_GOTREF(__pyx_t_3); if (__Pyx_IternextUnpackEndCheck(__pyx_t_20(__pyx_t_7), 2) < 0) __PYX_ERR(0, 908, __pyx_L1_error) __pyx_t_20 = NULL; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; goto __pyx_L28_unpacking_done; __pyx_L27_unpacking_failed:; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_20 = NULL; if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); __PYX_ERR(0, 908, __pyx_L1_error) __pyx_L28_unpacking_done:; } __pyx_v_arr = __pyx_t_8; __pyx_t_8 = 0; __pyx_v__ = __pyx_t_3; __pyx_t_3 = 0;
+0909: arr *= (self.scaled_to / np.max(np.abs(arr)))
__pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_scaled_to); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 909, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 909, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_max); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 909, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_np); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 909, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __pyx_t_21 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_abs); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 909, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_21); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __pyx_t_10 = NULL; __pyx_t_6 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_21))) { __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_21); if (likely(__pyx_t_10)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_21); __Pyx_INCREF(__pyx_t_10); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_21, function); __pyx_t_6 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_10, __pyx_v_arr}; __pyx_t_8 = __Pyx_PyObject_FastCall(__pyx_t_21, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6); __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 909, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0; } __pyx_t_21 = NULL; __pyx_t_6 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_7))) { __pyx_t_21 = PyMethod_GET_SELF(__pyx_t_7); if (likely(__pyx_t_21)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7); __Pyx_INCREF(__pyx_t_21); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_7, function); __pyx_t_6 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_21, __pyx_t_8}; __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_7, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6); __Pyx_XDECREF(__pyx_t_21); __pyx_t_21 = 0; __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 909, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; } __pyx_t_7 = __Pyx_PyNumber_Divide(__pyx_t_5, __pyx_t_3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 909, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyNumber_InPlaceMultiply(__pyx_v_arr, __pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 909, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF_SET(__pyx_v_arr, __pyx_t_3); __pyx_t_3 = 0;
0910: # handle error
+0911: ndarray2file(self.output, arr)
__Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_ndarray2file); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 911, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_output); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 911, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_8 = NULL; __pyx_t_6 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_7))) { __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7); if (likely(__pyx_t_8)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7); __Pyx_INCREF(__pyx_t_8); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_7, function); __pyx_t_6 = 1; } } #endif { PyObject *__pyx_callargs[3] = {__pyx_t_8, __pyx_t_5, __pyx_v_arr}; __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_7, __pyx_callargs+1-__pyx_t_6, 2+__pyx_t_6); __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 911, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
0912: else:
+0913: self.output *= (self.scaled_to / np.max(np.abs(self.output)))
/*else*/ {
__pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_output); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 913, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_scaled_to); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 913, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_7);
__Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 913, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_8);
__pyx_t_21 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_max); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 913, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_21);
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
__Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_np); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 913, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_10);
__pyx_t_22 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_abs); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 913, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_22);
__Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
__pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_output); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 913, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_10);
__pyx_t_23 = NULL;
__pyx_t_6 = 0;
#if CYTHON_UNPACK_METHODS
if (unlikely(PyMethod_Check(__pyx_t_22))) {
__pyx_t_23 = PyMethod_GET_SELF(__pyx_t_22);
if (likely(__pyx_t_23)) {
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_22);
__Pyx_INCREF(__pyx_t_23);
__Pyx_INCREF(function);
__Pyx_DECREF_SET(__pyx_t_22, function);
__pyx_t_6 = 1;
}
}
#endif
{
PyObject *__pyx_callargs[2] = {__pyx_t_23, __pyx_t_10};
__pyx_t_8 = __Pyx_PyObject_FastCall(__pyx_t_22, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6);
__Pyx_XDECREF(__pyx_t_23); __pyx_t_23 = 0;
__Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 913, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_8);
__Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
}
__pyx_t_22 = NULL;
__pyx_t_6 = 0;
#if CYTHON_UNPACK_METHODS
if (unlikely(PyMethod_Check(__pyx_t_21))) {
__pyx_t_22 = PyMethod_GET_SELF(__pyx_t_21);
if (likely(__pyx_t_22)) {
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_21);
__Pyx_INCREF(__pyx_t_22);
__Pyx_INCREF(function);
__Pyx_DECREF_SET(__pyx_t_21, function);
__pyx_t_6 = 1;
}
}
#endif
{
PyObject *__pyx_callargs[2] = {__pyx_t_22, __pyx_t_8};
__pyx_t_5 = __Pyx_PyObject_FastCall(__pyx_t_21, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6);
__Pyx_XDECREF(__pyx_t_22); __pyx_t_22 = 0;
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 913, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
}
__pyx_t_21 = __Pyx_PyNumber_Divide(__pyx_t_7, __pyx_t_5); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 913, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_21);
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__pyx_t_5 = PyNumber_InPlaceMultiply(__pyx_t_3, __pyx_t_21); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 913, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_output, __pyx_t_5) < 0) __PYX_ERR(0, 913, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
}
__pyx_L26:;
+0914: elif self.scaled_by:
__pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_scaled_by); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 914, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 914, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_4) { /* … */ } __pyx_L25:;
+0915: if self.output_to_file:
__pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_output_to_file); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 915, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 915, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_4) { /* … */ goto __pyx_L29; }
+0916: arr, _ = file2ndarray(self.output)
__Pyx_GetModuleGlobalName(__pyx_t_21, __pyx_n_s_file2ndarray_2); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 916, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_21); __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_output); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 916, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_7 = NULL; __pyx_t_6 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_21))) { __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_21); if (likely(__pyx_t_7)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_21); __Pyx_INCREF(__pyx_t_7); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_21, function); __pyx_t_6 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_t_3}; __pyx_t_5 = __Pyx_PyObject_FastCall(__pyx_t_21, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6); __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 916, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0; } if ((likely(PyTuple_CheckExact(__pyx_t_5))) || (PyList_CheckExact(__pyx_t_5))) { PyObject* sequence = __pyx_t_5; Py_ssize_t size = __Pyx_PySequence_SIZE(sequence); if (unlikely(size != 2)) { if (size > 2) __Pyx_RaiseTooManyValuesError(2); else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); __PYX_ERR(0, 916, __pyx_L1_error) } #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS if (likely(PyTuple_CheckExact(sequence))) { __pyx_t_21 = PyTuple_GET_ITEM(sequence, 0); __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); } else { __pyx_t_21 = PyList_GET_ITEM(sequence, 0); __pyx_t_3 = PyList_GET_ITEM(sequence, 1); } __Pyx_INCREF(__pyx_t_21); __Pyx_INCREF(__pyx_t_3); #else __pyx_t_21 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 916, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_21); __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 916, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); #endif __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } else { Py_ssize_t index = -1; __pyx_t_7 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 916, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_20 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_7); index = 0; __pyx_t_21 = __pyx_t_20(__pyx_t_7); if (unlikely(!__pyx_t_21)) goto __pyx_L30_unpacking_failed; __Pyx_GOTREF(__pyx_t_21); index = 1; __pyx_t_3 = __pyx_t_20(__pyx_t_7); if (unlikely(!__pyx_t_3)) goto __pyx_L30_unpacking_failed; __Pyx_GOTREF(__pyx_t_3); if (__Pyx_IternextUnpackEndCheck(__pyx_t_20(__pyx_t_7), 2) < 0) __PYX_ERR(0, 916, __pyx_L1_error) __pyx_t_20 = NULL; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; goto __pyx_L31_unpacking_done; __pyx_L30_unpacking_failed:; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_20 = NULL; if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); __PYX_ERR(0, 916, __pyx_L1_error) __pyx_L31_unpacking_done:; } __pyx_v_arr = __pyx_t_21; __pyx_t_21 = 0; __pyx_v__ = __pyx_t_3; __pyx_t_3 = 0;
+0917: arr *= self.scaled_by
__pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_scaled_by); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 917, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_3 = PyNumber_InPlaceMultiply(__pyx_v_arr, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 917, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF_SET(__pyx_v_arr, __pyx_t_3); __pyx_t_3 = 0;
+0918: ndarray2file(self.output, arr)
__Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_ndarray2file); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 918, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_21 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_output); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 918, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_21); __pyx_t_7 = NULL; __pyx_t_6 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_5))) { __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5); if (likely(__pyx_t_7)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); __Pyx_INCREF(__pyx_t_7); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_5, function); __pyx_t_6 = 1; } } #endif { PyObject *__pyx_callargs[3] = {__pyx_t_7, __pyx_t_21, __pyx_v_arr}; __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_6, 2+__pyx_t_6); __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 918, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
0919: else:
+0920: self.output *= self.scaled_by
/*else*/ {
__pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_output); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 920, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_scaled_by); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 920, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_5);
__pyx_t_21 = PyNumber_InPlaceMultiply(__pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 920, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_21);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_output, __pyx_t_21) < 0) __PYX_ERR(0, 920, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
}
__pyx_L29:;
0921:
+0922: if self.play and self.output_to_file:
__pyx_t_21 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_play); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 922, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_21); __pyx_t_19 = __Pyx_PyObject_IsTrue(__pyx_t_21); if (unlikely((__pyx_t_19 < 0))) __PYX_ERR(0, 922, __pyx_L1_error) __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0; if (__pyx_t_19) { } else { __pyx_t_4 = __pyx_t_19; goto __pyx_L33_bool_binop_done; } __pyx_t_21 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_output_to_file); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 922, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_21); __pyx_t_19 = __Pyx_PyObject_IsTrue(__pyx_t_21); if (unlikely((__pyx_t_19 < 0))) __PYX_ERR(0, 922, __pyx_L1_error) __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0; __pyx_t_4 = __pyx_t_19; __pyx_L33_bool_binop_done:; if (__pyx_t_4) { /* … */ }
+0923: subprocess.run([CLM.player,self.output])
__Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_subprocess); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 923, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_run); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 923, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_CLM); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 923, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_player); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 923, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_output); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 923, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_8 = PyList_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 923, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_GIVEREF(__pyx_t_7); if (__Pyx_PyList_SET_ITEM(__pyx_t_8, 0, __pyx_t_7)) __PYX_ERR(0, 923, __pyx_L1_error); __Pyx_GIVEREF(__pyx_t_5); if (__Pyx_PyList_SET_ITEM(__pyx_t_8, 1, __pyx_t_5)) __PYX_ERR(0, 923, __pyx_L1_error); __pyx_t_7 = 0; __pyx_t_5 = 0; __pyx_t_5 = NULL; __pyx_t_6 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_3))) { __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_5)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_5); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); __pyx_t_6 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_t_8}; __pyx_t_21 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6); __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 923, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_21); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
0924: # need some safety if errors
0925:
+0926: set_srate(self.old_srate)
__pyx_t_21 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_old_srate); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 926, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_21); __pyx_t_24 = __pyx_PyFloat_AsDouble(__pyx_t_21); if (unlikely((__pyx_t_24 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 926, __pyx_L1_error) __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0; __pyx_t_25 = __pyx_f_8pysndlib_3clm_set_srate(__pyx_t_24, 0); if (unlikely(__pyx_t_25 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 926, __pyx_L1_error)
0927:
+0928: if self.finalize:
__pyx_t_21 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_finalize); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 928, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_21); __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_21); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 928, __pyx_L1_error) __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0; if (__pyx_t_4) { /* … */ }
+0929: self.finalize(self.output)
__pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_finalize); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 929, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_output); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 929, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __pyx_t_5 = NULL; __pyx_t_6 = 0; #if CYTHON_UNPACK_METHODS if (likely(PyMethod_Check(__pyx_t_3))) { __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_5)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_5); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); __pyx_t_6 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_t_8}; __pyx_t_21 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6); __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 929, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_21); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
0930:
0931:
+0932: cpdef is_list_or_ndarray(x):
static PyObject *__pyx_pw_8pysndlib_3clm_11is_list_or_ndarray(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyObject *__pyx_f_8pysndlib_3clm_is_list_or_ndarray(PyObject *__pyx_v_x, CYTHON_UNUSED int __pyx_skip_dispatch) {
PyObject *__pyx_r = NULL;
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_AddTraceback("pysndlib.clm.is_list_or_ndarray", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_11is_list_or_ndarray(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_8pysndlib_3clm_11is_list_or_ndarray = {"is_list_or_ndarray", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_11is_list_or_ndarray, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_8pysndlib_3clm_11is_list_or_ndarray(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
PyObject *__pyx_v_x = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("is_list_or_ndarray (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,0};
PyObject* values[1] = {0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_x)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 932, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "is_list_or_ndarray") < 0)) __PYX_ERR(0, 932, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 1)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
}
__pyx_v_x = values[0];
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("is_list_or_ndarray", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 932, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.is_list_or_ndarray", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_8pysndlib_3clm_10is_list_or_ndarray(__pyx_self, __pyx_v_x);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_10is_list_or_ndarray(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_x) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8pysndlib_3clm_is_list_or_ndarray(__pyx_v_x, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 932, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("pysndlib.clm.is_list_or_ndarray", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_tuple__151 = PyTuple_Pack(1, __pyx_n_s_x); if (unlikely(!__pyx_tuple__151)) __PYX_ERR(0, 932, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__151);
__Pyx_GIVEREF(__pyx_tuple__151);
/* … */
__pyx_t_43 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_11is_list_or_ndarray, 0, __pyx_n_s_is_list_or_ndarray, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__152)); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 932, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_is_list_or_ndarray, __pyx_t_43) < 0) __PYX_ERR(0, 932, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
__pyx_codeobj__152 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__151, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_is_list_or_ndarray, 932, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__152)) __PYX_ERR(0, 932, __pyx_L1_error)
+0933: return isinstance(x, list) or isinstance(x, np.ndarray)
__Pyx_XDECREF(__pyx_r); __pyx_t_2 = PyList_Check(__pyx_v_x); if (!__pyx_t_2) { } else { __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 933, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_1 = __pyx_t_3; __pyx_t_3 = 0; goto __pyx_L3_bool_binop_done; } __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_x, __pyx_ptype_5numpy_ndarray); __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 933, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_1 = __pyx_t_3; __pyx_t_3 = 0; __pyx_L3_bool_binop_done:; __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
0934:
+0935: cpdef is_power_of_2(x):
static PyObject *__pyx_pw_8pysndlib_3clm_13is_power_of_2(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyObject *__pyx_f_8pysndlib_3clm_is_power_of_2(PyObject *__pyx_v_x, CYTHON_UNUSED int __pyx_skip_dispatch) {
PyObject *__pyx_r = NULL;
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("pysndlib.clm.is_power_of_2", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_13is_power_of_2(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_8pysndlib_3clm_13is_power_of_2 = {"is_power_of_2", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_13is_power_of_2, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_8pysndlib_3clm_13is_power_of_2(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
PyObject *__pyx_v_x = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("is_power_of_2 (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,0};
PyObject* values[1] = {0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_x)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 935, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "is_power_of_2") < 0)) __PYX_ERR(0, 935, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 1)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
}
__pyx_v_x = values[0];
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("is_power_of_2", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 935, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.is_power_of_2", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_8pysndlib_3clm_12is_power_of_2(__pyx_self, __pyx_v_x);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_12is_power_of_2(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_x) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8pysndlib_3clm_is_power_of_2(__pyx_v_x, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 935, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("pysndlib.clm.is_power_of_2", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_43 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_13is_power_of_2, 0, __pyx_n_s_is_power_of_2, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__153)); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 935, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_is_power_of_2, __pyx_t_43) < 0) __PYX_ERR(0, 935, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
/* … */
__pyx_codeobj__153 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__151, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_is_power_of_2, 935, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__153)) __PYX_ERR(0, 935, __pyx_L1_error)
+0936: return (((x) - 1) & (x)) == 0
__Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyInt_SubtractObjC(__pyx_v_x, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 936, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = PyNumber_And(__pyx_t_1, __pyx_v_x); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 936, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_PyInt_EqObjC(__pyx_t_2, __pyx_int_0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 936, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
0937:
+0938: cpdef next_power_of_2(x):
static PyObject *__pyx_pw_8pysndlib_3clm_15next_power_of_2(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyObject *__pyx_f_8pysndlib_3clm_next_power_of_2(PyObject *__pyx_v_x, CYTHON_UNUSED int __pyx_skip_dispatch) {
PyObject *__pyx_r = NULL;
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_AddTraceback("pysndlib.clm.next_power_of_2", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_15next_power_of_2(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_8pysndlib_3clm_15next_power_of_2 = {"next_power_of_2", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_15next_power_of_2, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_8pysndlib_3clm_15next_power_of_2(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
PyObject *__pyx_v_x = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("next_power_of_2 (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,0};
PyObject* values[1] = {0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_x)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 938, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "next_power_of_2") < 0)) __PYX_ERR(0, 938, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 1)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
}
__pyx_v_x = values[0];
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("next_power_of_2", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 938, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.next_power_of_2", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_8pysndlib_3clm_14next_power_of_2(__pyx_self, __pyx_v_x);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_14next_power_of_2(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_x) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8pysndlib_3clm_next_power_of_2(__pyx_v_x, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 938, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("pysndlib.clm.next_power_of_2", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_43 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_15next_power_of_2, 0, __pyx_n_s_next_power_of_2, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__154)); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 938, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_next_power_of_2, __pyx_t_43) < 0) __PYX_ERR(0, 938, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
/* … */
__pyx_codeobj__154 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__151, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_next_power_of_2, 938, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__154)) __PYX_ERR(0, 938, __pyx_L1_error)
+0939: return 2**int(1 + (float(math.log(x + 1)) / math.log(2.0)))
__Pyx_XDECREF(__pyx_r); __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_math); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 939, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_log); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 939, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_PyInt_AddObjC(__pyx_v_x, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 939, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_4 = NULL; __pyx_t_5 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_3))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); __pyx_t_5 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_2}; __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 939, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } __pyx_t_3 = __Pyx_PyNumber_Float(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 939, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_math); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 939, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_log); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 939, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = NULL; __pyx_t_5 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_4))) { __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4); if (likely(__pyx_t_2)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); __Pyx_INCREF(__pyx_t_2); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_4, function); __pyx_t_5 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_float_2_0}; __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 939, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } __pyx_t_4 = __Pyx_PyNumber_Divide(__pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 939, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_PyInt_AddCObj(__pyx_int_1, __pyx_t_4, 1, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 939, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = __Pyx_PyNumber_Int(__pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 939, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_PyNumber_PowerOf2(__pyx_int_2, __pyx_t_4, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 939, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
0940:
0941:
0942: # TODO: could be simplified now
+0943: cpdef np.ndarray to_partials(harms):
static PyObject *__pyx_pw_8pysndlib_3clm_17to_partials(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyArrayObject *__pyx_f_8pysndlib_3clm_to_partials(PyObject *__pyx_v_harms, CYTHON_UNUSED int __pyx_skip_dispatch) {
PyObject *__pyx_v_p = NULL;
PyObject *__pyx_v_maxpartial = NULL;
PyObject *__pyx_v_partials = NULL;
PyObject *__pyx_v_i = NULL;
PyArrayObject *__pyx_r = NULL;
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_XDECREF(__pyx_t_5);
__Pyx_XDECREF(__pyx_t_6);
__Pyx_AddTraceback("pysndlib.clm.to_partials", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XDECREF(__pyx_v_p);
__Pyx_XDECREF(__pyx_v_maxpartial);
__Pyx_XDECREF(__pyx_v_partials);
__Pyx_XDECREF(__pyx_v_i);
__Pyx_XGIVEREF((PyObject *)__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_17to_partials(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_8pysndlib_3clm_17to_partials = {"to_partials", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_17to_partials, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_8pysndlib_3clm_17to_partials(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
PyObject *__pyx_v_harms = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("to_partials (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_harms,0};
PyObject* values[1] = {0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_harms)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 943, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "to_partials") < 0)) __PYX_ERR(0, 943, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 1)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
}
__pyx_v_harms = values[0];
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("to_partials", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 943, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.to_partials", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_8pysndlib_3clm_16to_partials(__pyx_self, __pyx_v_harms);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_16to_partials(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_harms) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = ((PyObject *)__pyx_f_8pysndlib_3clm_to_partials(__pyx_v_harms, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 943, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("pysndlib.clm.to_partials", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_tuple__155 = PyTuple_Pack(1, __pyx_n_s_harms); if (unlikely(!__pyx_tuple__155)) __PYX_ERR(0, 943, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__155);
__Pyx_GIVEREF(__pyx_tuple__155);
/* … */
__pyx_t_43 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_17to_partials, 0, __pyx_n_s_to_partials, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__156)); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 943, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_to_partials, __pyx_t_43) < 0) __PYX_ERR(0, 943, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
__pyx_codeobj__156 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__155, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_to_partials, 943, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__156)) __PYX_ERR(0, 943, __pyx_L1_error)
+0944: if isinstance(harms, list):
__pyx_t_1 = PyList_Check(__pyx_v_harms);
if (__pyx_t_1) {
/* … */
}
+0945: p = harms[::2]
__pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_v_harms, __pyx_slice__18); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 945, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_v_p = __pyx_t_2; __pyx_t_2 = 0; /* … */ __pyx_slice__18 = PySlice_New(Py_None, Py_None, __pyx_int_2); if (unlikely(!__pyx_slice__18)) __PYX_ERR(0, 945, __pyx_L1_error) __Pyx_GOTREF(__pyx_slice__18); __Pyx_GIVEREF(__pyx_slice__18);
+0946: maxpartial = max(p)
__pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_max, __pyx_v_p); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 946, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_v_maxpartial = __pyx_t_2; __pyx_t_2 = 0;
+0947: partials = np.zeros(int(maxpartial)+1, dtype=np.double)
__Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 947, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 947, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_PyNumber_Int(__pyx_v_maxpartial); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 947, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_4 = __Pyx_PyInt_AddObjC(__pyx_t_2, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 947, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 947, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_GIVEREF(__pyx_t_4); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_4)) __PYX_ERR(0, 947, __pyx_L1_error); __pyx_t_4 = 0; __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 947, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 947, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_double); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 947, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_dtype, __pyx_t_6) < 0) __PYX_ERR(0, 947, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_2, __pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 947, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_v_partials = __pyx_t_6; __pyx_t_6 = 0;
+0948: check_ndim(partials)
__pyx_t_6 = __pyx_f_8pysndlib_3clm_check_ndim(__pyx_v_partials, 0, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 948, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+0949: for i in range(0, len(harms),2):
__pyx_t_7 = PyObject_Length(__pyx_v_harms); if (unlikely(__pyx_t_7 == ((Py_ssize_t)-1))) __PYX_ERR(0, 949, __pyx_L1_error) __pyx_t_6 = PyInt_FromSsize_t(__pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 949, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 949, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_INCREF(__pyx_int_0); __Pyx_GIVEREF(__pyx_int_0); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_int_0)) __PYX_ERR(0, 949, __pyx_L1_error); __Pyx_GIVEREF(__pyx_t_6); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_6)) __PYX_ERR(0, 949, __pyx_L1_error); __Pyx_INCREF(__pyx_int_2); __Pyx_GIVEREF(__pyx_int_2); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_int_2)) __PYX_ERR(0, 949, __pyx_L1_error); __pyx_t_6 = 0; __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_4, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 949, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (likely(PyList_CheckExact(__pyx_t_6)) || PyTuple_CheckExact(__pyx_t_6)) { __pyx_t_4 = __pyx_t_6; __Pyx_INCREF(__pyx_t_4); __pyx_t_7 = 0; __pyx_t_8 = NULL; } else { __pyx_t_7 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 949, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_8 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_4); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 949, __pyx_L1_error) } __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; for (;;) { if (likely(!__pyx_t_8)) { if (likely(PyList_CheckExact(__pyx_t_4))) { { Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_4); #if !CYTHON_ASSUME_SAFE_MACROS if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 949, __pyx_L1_error) #endif if (__pyx_t_7 >= __pyx_temp) break; } #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS __pyx_t_6 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_7); __Pyx_INCREF(__pyx_t_6); __pyx_t_7++; if (unlikely((0 < 0))) __PYX_ERR(0, 949, __pyx_L1_error) #else __pyx_t_6 = __Pyx_PySequence_ITEM(__pyx_t_4, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 949, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); #endif } else { { Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_4); #if !CYTHON_ASSUME_SAFE_MACROS if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 949, __pyx_L1_error) #endif if (__pyx_t_7 >= __pyx_temp) break; } #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_7); __Pyx_INCREF(__pyx_t_6); __pyx_t_7++; if (unlikely((0 < 0))) __PYX_ERR(0, 949, __pyx_L1_error) #else __pyx_t_6 = __Pyx_PySequence_ITEM(__pyx_t_4, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 949, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); #endif } } else { __pyx_t_6 = __pyx_t_8(__pyx_t_4); if (unlikely(!__pyx_t_6)) { PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); else __PYX_ERR(0, 949, __pyx_L1_error) } break; } __Pyx_GOTREF(__pyx_t_6); } __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_6); __pyx_t_6 = 0; /* … */ } __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+0950: partials[int(harms[i])] = harms[i+1]
__pyx_t_6 = __Pyx_PyInt_AddObjC(__pyx_v_i, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 950, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_v_harms, __pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 950, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_6 = __Pyx_PyObject_GetItem(__pyx_v_harms, __pyx_v_i); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 950, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_3 = __Pyx_PyNumber_Int(__pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 950, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; if (unlikely((PyObject_SetItem(__pyx_v_partials, __pyx_t_3, __pyx_t_2) < 0))) __PYX_ERR(0, 950, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
0951: #print('to_partials', partials)
+0952: return partials
__Pyx_XDECREF((PyObject *)__pyx_r); if (!(likely(((__pyx_v_partials) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_partials, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 952, __pyx_L1_error) __Pyx_INCREF(__pyx_v_partials); __pyx_r = ((PyArrayObject *)__pyx_v_partials); goto __pyx_L0;
+0953: elif isinstance(harms[0], np.double):
__pyx_t_4 = __Pyx_GetItemInt(__pyx_v_harms, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 953, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 953, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_double); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 953, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_1 = PyObject_IsInstance(__pyx_t_4, __pyx_t_3); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 953, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (likely(__pyx_t_1)) { /* … */ }
+0954: p = harms[::2]
__pyx_t_3 = __Pyx_PyObject_GetItem(__pyx_v_harms, __pyx_slice__18); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 954, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_v_p = __pyx_t_3; __pyx_t_3 = 0;
+0955: maxpartial = np.max(p)
__Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 955, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_max); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 955, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = NULL; __pyx_t_9 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_2))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); __pyx_t_9 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v_p}; __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_9, 1+__pyx_t_9); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 955, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } __pyx_v_maxpartial = __pyx_t_3; __pyx_t_3 = 0;
+0956: partials = np.zeros(int(maxpartial)+1, dtype=np.double)
__Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 956, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 956, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = __Pyx_PyNumber_Int(__pyx_v_maxpartial); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 956, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = __Pyx_PyInt_AddObjC(__pyx_t_3, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 956, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 956, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_GIVEREF(__pyx_t_4); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4)) __PYX_ERR(0, 956, __pyx_L1_error); __pyx_t_4 = 0; __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 956, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 956, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_double); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 956, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_dtype, __pyx_t_5) < 0) __PYX_ERR(0, 956, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 956, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_v_partials = __pyx_t_5; __pyx_t_5 = 0;
+0957: check_ndim(partials)
__pyx_t_5 = __pyx_f_8pysndlib_3clm_check_ndim(__pyx_v_partials, 0, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 957, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+0958: for i in range(0, len(harms),2):
__pyx_t_7 = PyObject_Length(__pyx_v_harms); if (unlikely(__pyx_t_7 == ((Py_ssize_t)-1))) __PYX_ERR(0, 958, __pyx_L1_error) __pyx_t_5 = PyInt_FromSsize_t(__pyx_t_7); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 958, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 958, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_INCREF(__pyx_int_0); __Pyx_GIVEREF(__pyx_int_0); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_int_0)) __PYX_ERR(0, 958, __pyx_L1_error); __Pyx_GIVEREF(__pyx_t_5); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_5)) __PYX_ERR(0, 958, __pyx_L1_error); __Pyx_INCREF(__pyx_int_2); __Pyx_GIVEREF(__pyx_int_2); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_int_2)) __PYX_ERR(0, 958, __pyx_L1_error); __pyx_t_5 = 0; __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 958, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (likely(PyList_CheckExact(__pyx_t_5)) || PyTuple_CheckExact(__pyx_t_5)) { __pyx_t_4 = __pyx_t_5; __Pyx_INCREF(__pyx_t_4); __pyx_t_7 = 0; __pyx_t_8 = NULL; } else { __pyx_t_7 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 958, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_8 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_4); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 958, __pyx_L1_error) } __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; for (;;) { if (likely(!__pyx_t_8)) { if (likely(PyList_CheckExact(__pyx_t_4))) { { Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_4); #if !CYTHON_ASSUME_SAFE_MACROS if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 958, __pyx_L1_error) #endif if (__pyx_t_7 >= __pyx_temp) break; } #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS __pyx_t_5 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_7); __Pyx_INCREF(__pyx_t_5); __pyx_t_7++; if (unlikely((0 < 0))) __PYX_ERR(0, 958, __pyx_L1_error) #else __pyx_t_5 = __Pyx_PySequence_ITEM(__pyx_t_4, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 958, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); #endif } else { { Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_4); #if !CYTHON_ASSUME_SAFE_MACROS if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 958, __pyx_L1_error) #endif if (__pyx_t_7 >= __pyx_temp) break; } #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_7); __Pyx_INCREF(__pyx_t_5); __pyx_t_7++; if (unlikely((0 < 0))) __PYX_ERR(0, 958, __pyx_L1_error) #else __pyx_t_5 = __Pyx_PySequence_ITEM(__pyx_t_4, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 958, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); #endif } } else { __pyx_t_5 = __pyx_t_8(__pyx_t_4); if (unlikely(!__pyx_t_5)) { PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); else __PYX_ERR(0, 958, __pyx_L1_error) } break; } __Pyx_GOTREF(__pyx_t_5); } __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_5); __pyx_t_5 = 0; /* … */ } __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+0959: partials[int(harms[i])] = harms[i+1]
__pyx_t_5 = __Pyx_PyInt_AddObjC(__pyx_v_i, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 959, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_3 = __Pyx_PyObject_GetItem(__pyx_v_harms, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 959, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_v_harms, __pyx_v_i); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 959, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_2 = __Pyx_PyNumber_Int(__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 959, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (unlikely((PyObject_SetItem(__pyx_v_partials, __pyx_t_2, __pyx_t_3) < 0))) __PYX_ERR(0, 959, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
0960: #print('to_partials', partials)
+0961: return partials
__Pyx_XDECREF((PyObject *)__pyx_r); if (!(likely(((__pyx_v_partials) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_partials, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 961, __pyx_L1_error) __Pyx_INCREF(__pyx_v_partials); __pyx_r = ((PyArrayObject *)__pyx_v_partials); goto __pyx_L0;
0962: else:
+0963: raise TypeError(f'{type(harms)} cannot be converted to a mus_float_array')
/*else*/ {
__pyx_t_4 = __Pyx_PyObject_FormatSimple(((PyObject *)Py_TYPE(__pyx_v_harms)), __pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 963, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
__pyx_t_3 = __Pyx_PyUnicode_ConcatInPlace(__pyx_t_4, __pyx_kp_u_cannot_be_converted_to_a_mus_fl); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 963, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 963, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_Raise(__pyx_t_4, 0, 0, 0);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__PYX_ERR(0, 963, __pyx_L1_error)
}
0964:
0965:
0966: # --------------- generic functions ---------------- #
0967:
0968: # cpdef int tester(int x) :
0969: # return x
0970:
+0971: cpdef int mus_close(mus_any obj):
static PyObject *__pyx_pw_8pysndlib_3clm_19mus_close(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static int __pyx_f_8pysndlib_3clm_mus_close(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_obj, CYTHON_UNUSED int __pyx_skip_dispatch) {
int __pyx_r;
/* … */
/* function exit code */
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_19mus_close(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_8pysndlib_3clm_19mus_close = {"mus_close", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_19mus_close, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_8pysndlib_3clm_19mus_close(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_obj = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("mus_close (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_obj,0};
PyObject* values[1] = {0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_obj)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 971, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "mus_close") < 0)) __PYX_ERR(0, 971, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 1)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
}
__pyx_v_obj = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)values[0]);
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("mus_close", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 971, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.mus_close", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_obj), __pyx_ptype_8pysndlib_3clm_mus_any, 1, "obj", 0))) __PYX_ERR(0, 971, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_18mus_close(__pyx_self, __pyx_v_obj);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_18mus_close(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_obj) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8pysndlib_3clm_mus_close(__pyx_v_obj, 0); if (unlikely(__pyx_t_1 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 971, __pyx_L1_error)
__pyx_t_2 = __Pyx_PyInt_From_int(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 971, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("pysndlib.clm.mus_close", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_tuple__157 = PyTuple_Pack(1, __pyx_n_s_obj); if (unlikely(!__pyx_tuple__157)) __PYX_ERR(0, 971, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__157);
__Pyx_GIVEREF(__pyx_tuple__157);
/* … */
__pyx_t_43 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_19mus_close, 0, __pyx_n_s_mus_close, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__158)); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 971, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_mus_close, __pyx_t_43) < 0) __PYX_ERR(0, 971, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
__pyx_codeobj__158 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__157, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_mus_close, 971, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__158)) __PYX_ERR(0, 971, __pyx_L1_error)
+0972: return cclm.mus_close_file(obj._ptr)
__pyx_r = mus_close_file(__pyx_v_obj->_ptr); goto __pyx_L0;
0973:
+0974: cpdef bint mus_is_output(mus_any obj):
static PyObject *__pyx_pw_8pysndlib_3clm_21mus_is_output(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static int __pyx_f_8pysndlib_3clm_mus_is_output(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_obj, CYTHON_UNUSED int __pyx_skip_dispatch) {
int __pyx_r;
/* … */
/* function exit code */
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_21mus_is_output(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_20mus_is_output, "\n returns True if gen is a type of output\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_21mus_is_output = {"mus_is_output", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_21mus_is_output, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_20mus_is_output};
static PyObject *__pyx_pw_8pysndlib_3clm_21mus_is_output(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_obj = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("mus_is_output (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_obj,0};
PyObject* values[1] = {0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_obj)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 974, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "mus_is_output") < 0)) __PYX_ERR(0, 974, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 1)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
}
__pyx_v_obj = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)values[0]);
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("mus_is_output", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 974, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.mus_is_output", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_obj), __pyx_ptype_8pysndlib_3clm_mus_any, 1, "obj", 0))) __PYX_ERR(0, 974, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_20mus_is_output(__pyx_self, __pyx_v_obj);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_20mus_is_output(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_obj) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8pysndlib_3clm_mus_is_output(__pyx_v_obj, 0); if (unlikely(__pyx_t_1 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 974, __pyx_L1_error)
__pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 974, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("pysndlib.clm.mus_is_output", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_43 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_21mus_is_output, 0, __pyx_n_s_mus_is_output, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__159)); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 974, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_mus_is_output, __pyx_t_43) < 0) __PYX_ERR(0, 974, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
/* … */
__pyx_codeobj__159 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__157, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_mus_is_output, 974, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__159)) __PYX_ERR(0, 974, __pyx_L1_error)
0975: """
0976: returns True if gen is a type of output
0977: """
+0978: return cclm.mus_is_output(obj._ptr)
__pyx_r = mus_is_output(__pyx_v_obj->_ptr); goto __pyx_L0;
0979:
+0980: cpdef bint mus_is_input(mus_any obj):
static PyObject *__pyx_pw_8pysndlib_3clm_23mus_is_input(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static int __pyx_f_8pysndlib_3clm_mus_is_input(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_obj, CYTHON_UNUSED int __pyx_skip_dispatch) {
int __pyx_r;
/* … */
/* function exit code */
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_23mus_is_input(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_22mus_is_input, "\n returns True if gen is a type of output\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_23mus_is_input = {"mus_is_input", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_23mus_is_input, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_22mus_is_input};
static PyObject *__pyx_pw_8pysndlib_3clm_23mus_is_input(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_obj = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("mus_is_input (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_obj,0};
PyObject* values[1] = {0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_obj)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 980, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "mus_is_input") < 0)) __PYX_ERR(0, 980, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 1)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
}
__pyx_v_obj = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)values[0]);
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("mus_is_input", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 980, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.mus_is_input", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_obj), __pyx_ptype_8pysndlib_3clm_mus_any, 1, "obj", 0))) __PYX_ERR(0, 980, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_22mus_is_input(__pyx_self, __pyx_v_obj);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_22mus_is_input(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_obj) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8pysndlib_3clm_mus_is_input(__pyx_v_obj, 0); if (unlikely(__pyx_t_1 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 980, __pyx_L1_error)
__pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 980, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("pysndlib.clm.mus_is_input", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_43 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_23mus_is_input, 0, __pyx_n_s_mus_is_input, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__160)); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 980, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_mus_is_input, __pyx_t_43) < 0) __PYX_ERR(0, 980, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
/* … */
__pyx_codeobj__160 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__157, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_mus_is_input, 980, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__160)) __PYX_ERR(0, 980, __pyx_L1_error)
0981: """
0982: returns True if gen is a type of output
0983: """
+0984: return cclm.mus_is_input(obj._ptr)
__pyx_r = mus_is_input(__pyx_v_obj->_ptr); goto __pyx_L0;
0985:
+0986: cpdef mus_reset(mus_any obj):
static PyObject *__pyx_pw_8pysndlib_3clm_25mus_reset(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyObject *__pyx_f_8pysndlib_3clm_mus_reset(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_obj, CYTHON_UNUSED int __pyx_skip_dispatch) {
PyObject *__pyx_r = NULL;
/* … */
/* function exit code */
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_25mus_reset(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_24mus_reset, "\n set gen to default starting state\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_25mus_reset = {"mus_reset", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_25mus_reset, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_24mus_reset};
static PyObject *__pyx_pw_8pysndlib_3clm_25mus_reset(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_obj = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("mus_reset (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_obj,0};
PyObject* values[1] = {0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_obj)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 986, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "mus_reset") < 0)) __PYX_ERR(0, 986, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 1)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
}
__pyx_v_obj = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)values[0]);
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("mus_reset", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 986, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.mus_reset", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_obj), __pyx_ptype_8pysndlib_3clm_mus_any, 1, "obj", 0))) __PYX_ERR(0, 986, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_24mus_reset(__pyx_self, __pyx_v_obj);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_24mus_reset(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_obj) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8pysndlib_3clm_mus_reset(__pyx_v_obj, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 986, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("pysndlib.clm.mus_reset", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_43 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_25mus_reset, 0, __pyx_n_s_mus_reset, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__161)); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 986, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_mus_reset, __pyx_t_43) < 0) __PYX_ERR(0, 986, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
/* … */
__pyx_codeobj__161 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__157, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_mus_reset, 986, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__161)) __PYX_ERR(0, 986, __pyx_L1_error)
0987: """
0988: set gen to default starting state
0989: """
+0990: cclm.mus_reset(obj._ptr)
mus_reset(__pyx_v_obj->_ptr);
0991:
0992:
0993: # prepending clm to functions to avoid name clashes
0994:
0995: # --------------- clm_length ---------------- #
0996:
+0997: cpdef cython.long clm_length(obj):
static PyObject *__pyx_pw_8pysndlib_3clm_27clm_length(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static long __pyx_f_8pysndlib_3clm_clm_length(PyObject *__pyx_v_obj, CYTHON_UNUSED int __pyx_skip_dispatch) {
long __pyx_r;
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_6);
__Pyx_XDECREF(__pyx_t_7);
__Pyx_AddTraceback("pysndlib.clm.clm_length", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = -1;
__pyx_L0:;
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_27clm_length(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_8pysndlib_3clm_27clm_length = {"clm_length", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_27clm_length, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_8pysndlib_3clm_27clm_length(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
PyObject *__pyx_v_obj = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("clm_length (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_obj,0};
PyObject* values[1] = {0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_obj)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 997, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "clm_length") < 0)) __PYX_ERR(0, 997, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 1)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
}
__pyx_v_obj = values[0];
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("clm_length", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 997, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.clm_length", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_8pysndlib_3clm_26clm_length(__pyx_self, __pyx_v_obj);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_26clm_length(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_obj) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8pysndlib_3clm_clm_length(__pyx_v_obj, 0); if (unlikely(__pyx_t_1 == ((long)-1) && PyErr_Occurred())) __PYX_ERR(0, 997, __pyx_L1_error)
__pyx_t_2 = __Pyx_PyInt_From_long(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 997, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("pysndlib.clm.clm_length", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_43 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_27clm_length, 0, __pyx_n_s_clm_length, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__162)); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 997, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_clm_length, __pyx_t_43) < 0) __PYX_ERR(0, 997, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
/* … */
__pyx_codeobj__162 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__157, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_clm_length, 997, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__162)) __PYX_ERR(0, 997, __pyx_L1_error)
0998: #assume file
+0999: if isinstance(obj, str):
__pyx_t_1 = PyString_Check(__pyx_v_obj);
if (__pyx_t_1) {
/* … */
}
+1000: return csndlib.mus_sound_length(obj)
__pyx_t_2 = __Pyx_PyObject_AsString(__pyx_v_obj); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 1000, __pyx_L1_error) __pyx_r = mus_sound_length(__pyx_t_2); goto __pyx_L0;
1001: #sndlib gen
+1002: elif isinstance(obj, mus_any):
__pyx_t_1 = __Pyx_TypeCheck(__pyx_v_obj, __pyx_ptype_8pysndlib_3clm_mus_any);
if (__pyx_t_1) {
/* … */
}
+1003: return obj.mus_length
__pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_obj, __pyx_n_s_mus_length); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1003, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = __Pyx_PyInt_As_long(__pyx_t_3); if (unlikely((__pyx_t_4 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 1003, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_r = __pyx_t_4; goto __pyx_L0;
+1004: elif isinstance(obj, list):
__pyx_t_1 = PyList_Check(__pyx_v_obj);
if (__pyx_t_1) {
/* … */
}
+1005: if isinstance(obj[0], list):
__pyx_t_3 = __Pyx_GetItemInt(__pyx_v_obj, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1005, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_1 = PyList_Check(__pyx_t_3); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_1) { /* … */ }
+1006: return len(obj[0])
__pyx_t_3 = __Pyx_GetItemInt(__pyx_v_obj, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1006, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = PyObject_Length(__pyx_t_3); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1006, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_r = __pyx_t_5; goto __pyx_L0;
1007: else:
+1008: return len(obj)
/*else*/ {
__pyx_t_5 = PyObject_Length(__pyx_v_obj); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1008, __pyx_L1_error)
__pyx_r = __pyx_t_5;
goto __pyx_L0;
}
+1009: elif isinstance(obj, np.ndarray):
__pyx_t_1 = __Pyx_TypeCheck(__pyx_v_obj, __pyx_ptype_5numpy_ndarray);
if (likely(__pyx_t_1)) {
/* … */
}
+1010: if obj.ndim == 1:
__pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_obj, __pyx_n_s_ndim); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1010, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_1 = (__Pyx_PyInt_BoolEqObjC(__pyx_t_3, __pyx_int_1, 1, 0)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 1010, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_1) { /* … */ }
+1011: return np.shape(obj)[0]
__Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1011, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_shape); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1011, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_6 = NULL; __pyx_t_8 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_7))) { __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_7); if (likely(__pyx_t_6)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7); __Pyx_INCREF(__pyx_t_6); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_7, function); __pyx_t_8 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_v_obj}; __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_7, __pyx_callargs+1-__pyx_t_8, 1+__pyx_t_8); __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1011, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; } __pyx_t_7 = __Pyx_GetItemInt(__pyx_t_3, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1011, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_4 = __Pyx_PyInt_As_long(__pyx_t_7); if (unlikely((__pyx_t_4 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 1011, __pyx_L1_error) __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_r = __pyx_t_4; goto __pyx_L0;
+1012: elif obj.ndim == 2:
__pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_obj, __pyx_n_s_ndim); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1012, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_1 = (__Pyx_PyInt_BoolEqObjC(__pyx_t_7, __pyx_int_2, 2, 0)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 1012, __pyx_L1_error) __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; if (likely(__pyx_t_1)) { /* … */ }
+1013: return np.shape(obj)[1]
__Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1013, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_shape); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1013, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = NULL; __pyx_t_8 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_6))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_6); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_6, function); __pyx_t_8 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v_obj}; __pyx_t_7 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+1-__pyx_t_8, 1+__pyx_t_8); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1013, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; } __pyx_t_6 = __Pyx_GetItemInt(__pyx_t_7, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1013, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_4 = __Pyx_PyInt_As_long(__pyx_t_6); if (unlikely((__pyx_t_4 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 1013, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_r = __pyx_t_4; goto __pyx_L0;
1014: else:
+1015: raise RuntimeError(f'ndarray must have 1 or 2 dimensions not {obj.ndim}.')
/*else*/ {
__pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1015, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_6);
__pyx_t_5 = 0;
__pyx_t_9 = 127;
__Pyx_INCREF(__pyx_kp_u_ndarray_must_have_1_or_2_dimensi);
__pyx_t_5 += 40;
__Pyx_GIVEREF(__pyx_kp_u_ndarray_must_have_1_or_2_dimensi);
PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_kp_u_ndarray_must_have_1_or_2_dimensi);
__pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_obj, __pyx_n_s_ndim); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1015, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_7);
__pyx_t_3 = __Pyx_PyObject_FormatSimple(__pyx_t_7, __pyx_empty_unicode); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1015, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
__pyx_t_9 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3) > __pyx_t_9) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3) : __pyx_t_9;
__pyx_t_5 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3);
__Pyx_GIVEREF(__pyx_t_3);
PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_3);
__pyx_t_3 = 0;
__Pyx_INCREF(__pyx_kp_u__3);
__pyx_t_5 += 1;
__Pyx_GIVEREF(__pyx_kp_u__3);
PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_kp_u__3);
__pyx_t_3 = __Pyx_PyUnicode_Join(__pyx_t_6, 3, __pyx_t_5, __pyx_t_9); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1015, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
__pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_builtin_RuntimeError, __pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1015, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_6);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_Raise(__pyx_t_6, 0, 0, 0);
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
__PYX_ERR(0, 1015, __pyx_L1_error)
}
1016: else:
+1017: raise RuntimeError(f'object {obj} has no meaningful lengtb. ')
/*else*/ {
__pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1017, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_6);
__pyx_t_5 = 0;
__pyx_t_9 = 127;
__Pyx_INCREF(__pyx_kp_u_object_2);
__pyx_t_5 += 7;
__Pyx_GIVEREF(__pyx_kp_u_object_2);
PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_kp_u_object_2);
__pyx_t_3 = __Pyx_PyObject_FormatSimple(__pyx_v_obj, __pyx_empty_unicode); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1017, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_9 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3) > __pyx_t_9) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3) : __pyx_t_9;
__pyx_t_5 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3);
__Pyx_GIVEREF(__pyx_t_3);
PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_3);
__pyx_t_3 = 0;
__Pyx_INCREF(__pyx_kp_u_has_no_meaningful_lengtb);
__pyx_t_5 += 27;
__Pyx_GIVEREF(__pyx_kp_u_has_no_meaningful_lengtb);
PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_kp_u_has_no_meaningful_lengtb);
__pyx_t_3 = __Pyx_PyUnicode_Join(__pyx_t_6, 3, __pyx_t_5, __pyx_t_9); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1017, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
__pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_builtin_RuntimeError, __pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1017, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_6);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_Raise(__pyx_t_6, 0, 0, 0);
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
__PYX_ERR(0, 1017, __pyx_L1_error)
}
1018:
1019:
1020:
1021:
1022: # --------------- clm_channels ---------------- #
1023:
+1024: cpdef cython.long clm_channels(obj):
static PyObject *__pyx_pw_8pysndlib_3clm_29clm_channels(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static long __pyx_f_8pysndlib_3clm_clm_channels(PyObject *__pyx_v_obj, CYTHON_UNUSED int __pyx_skip_dispatch) {
long __pyx_r;
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_6);
__Pyx_XDECREF(__pyx_t_7);
__Pyx_AddTraceback("pysndlib.clm.clm_channels", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = -1;
__pyx_L0:;
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_29clm_channels(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_8pysndlib_3clm_29clm_channels = {"clm_channels", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_29clm_channels, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_8pysndlib_3clm_29clm_channels(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
PyObject *__pyx_v_obj = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("clm_channels (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_obj,0};
PyObject* values[1] = {0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_obj)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1024, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "clm_channels") < 0)) __PYX_ERR(0, 1024, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 1)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
}
__pyx_v_obj = values[0];
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("clm_channels", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 1024, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.clm_channels", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_8pysndlib_3clm_28clm_channels(__pyx_self, __pyx_v_obj);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_28clm_channels(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_obj) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8pysndlib_3clm_clm_channels(__pyx_v_obj, 0); if (unlikely(__pyx_t_1 == ((long)-1) && PyErr_Occurred())) __PYX_ERR(0, 1024, __pyx_L1_error)
__pyx_t_2 = __Pyx_PyInt_From_long(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1024, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("pysndlib.clm.clm_channels", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_43 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_29clm_channels, 0, __pyx_n_s_clm_channels, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__163)); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 1024, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_clm_channels, __pyx_t_43) < 0) __PYX_ERR(0, 1024, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
/* … */
__pyx_codeobj__163 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__157, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_clm_channels, 1024, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__163)) __PYX_ERR(0, 1024, __pyx_L1_error)
+1025: if isinstance(obj, str):
__pyx_t_1 = PyString_Check(__pyx_v_obj);
if (__pyx_t_1) {
/* … */
}
+1026: return csndlib.mus_sound_chans(obj)
__pyx_t_2 = __Pyx_PyObject_AsString(__pyx_v_obj); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 1026, __pyx_L1_error) __pyx_r = mus_sound_chans(__pyx_t_2); goto __pyx_L0;
+1027: elif isinstance(obj, mus_any):
__pyx_t_1 = __Pyx_TypeCheck(__pyx_v_obj, __pyx_ptype_8pysndlib_3clm_mus_any);
if (__pyx_t_1) {
/* … */
}
+1028: return obj.mus_channel
__pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_obj, __pyx_n_s_mus_channel); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1028, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = __Pyx_PyInt_As_long(__pyx_t_3); if (unlikely((__pyx_t_4 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 1028, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_r = __pyx_t_4; goto __pyx_L0;
+1029: elif isinstance(obj, list):
__pyx_t_1 = PyList_Check(__pyx_v_obj);
if (__pyx_t_1) {
/* … */
}
+1030: return len(obj)
__pyx_t_5 = PyObject_Length(__pyx_v_obj); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1030, __pyx_L1_error) __pyx_r = __pyx_t_5; goto __pyx_L0;
+1031: elif isinstance(obj, np.ndarray):
__pyx_t_1 = __Pyx_TypeCheck(__pyx_v_obj, __pyx_ptype_5numpy_ndarray);
if (likely(__pyx_t_1)) {
/* … */
}
+1032: if obj.ndim == 1:
__pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_obj, __pyx_n_s_ndim); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1032, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_1 = (__Pyx_PyInt_BoolEqObjC(__pyx_t_3, __pyx_int_1, 1, 0)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 1032, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_1) { /* … */ }
+1033: return 1
__pyx_r = 1;
goto __pyx_L0;
+1034: elif obj.ndim == 2:
__pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_obj, __pyx_n_s_ndim); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1034, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_1 = (__Pyx_PyInt_BoolEqObjC(__pyx_t_3, __pyx_int_2, 2, 0)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 1034, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (likely(__pyx_t_1)) { /* … */ }
+1035: return np.shape(obj)[0]
__Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1035, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_shape); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1035, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_6 = NULL; __pyx_t_8 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_7))) { __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_7); if (likely(__pyx_t_6)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7); __Pyx_INCREF(__pyx_t_6); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_7, function); __pyx_t_8 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_v_obj}; __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_7, __pyx_callargs+1-__pyx_t_8, 1+__pyx_t_8); __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1035, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; } __pyx_t_7 = __Pyx_GetItemInt(__pyx_t_3, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1035, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_4 = __Pyx_PyInt_As_long(__pyx_t_7); if (unlikely((__pyx_t_4 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 1035, __pyx_L1_error) __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_r = __pyx_t_4; goto __pyx_L0;
1036: else:
+1037: raise RuntimeError(f'ndarray must have 1 or 2 dimensions not {obj.ndim}. ')
/*else*/ {
__pyx_t_7 = PyTuple_New(3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1037, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_7);
__pyx_t_5 = 0;
__pyx_t_9 = 127;
__Pyx_INCREF(__pyx_kp_u_ndarray_must_have_1_or_2_dimensi);
__pyx_t_5 += 40;
__Pyx_GIVEREF(__pyx_kp_u_ndarray_must_have_1_or_2_dimensi);
PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_kp_u_ndarray_must_have_1_or_2_dimensi);
__pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_obj, __pyx_n_s_ndim); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1037, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_6 = __Pyx_PyObject_FormatSimple(__pyx_t_3, __pyx_empty_unicode); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1037, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_6);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_9 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) > __pyx_t_9) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) : __pyx_t_9;
__pyx_t_5 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_6);
__Pyx_GIVEREF(__pyx_t_6);
PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_6);
__pyx_t_6 = 0;
__Pyx_INCREF(__pyx_kp_u__13);
__pyx_t_5 += 2;
__Pyx_GIVEREF(__pyx_kp_u__13);
PyTuple_SET_ITEM(__pyx_t_7, 2, __pyx_kp_u__13);
__pyx_t_6 = __Pyx_PyUnicode_Join(__pyx_t_7, 3, __pyx_t_5, __pyx_t_9); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1037, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_6);
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
__pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_builtin_RuntimeError, __pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1037, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_7);
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
__Pyx_Raise(__pyx_t_7, 0, 0, 0);
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
__PYX_ERR(0, 1037, __pyx_L1_error)
}
1038: else:
+1039: raise RuntimeError(f'object {obj} has no meaningful channels. ')
/*else*/ {
__pyx_t_7 = PyTuple_New(3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1039, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_7);
__pyx_t_5 = 0;
__pyx_t_9 = 127;
__Pyx_INCREF(__pyx_kp_u_object_2);
__pyx_t_5 += 7;
__Pyx_GIVEREF(__pyx_kp_u_object_2);
PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_kp_u_object_2);
__pyx_t_6 = __Pyx_PyObject_FormatSimple(__pyx_v_obj, __pyx_empty_unicode); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1039, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_6);
__pyx_t_9 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) > __pyx_t_9) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) : __pyx_t_9;
__pyx_t_5 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_6);
__Pyx_GIVEREF(__pyx_t_6);
PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_6);
__pyx_t_6 = 0;
__Pyx_INCREF(__pyx_kp_u_has_no_meaningful_channels);
__pyx_t_5 += 29;
__Pyx_GIVEREF(__pyx_kp_u_has_no_meaningful_channels);
PyTuple_SET_ITEM(__pyx_t_7, 2, __pyx_kp_u_has_no_meaningful_channels);
__pyx_t_6 = __Pyx_PyUnicode_Join(__pyx_t_7, 3, __pyx_t_5, __pyx_t_9); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1039, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_6);
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
__pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_builtin_RuntimeError, __pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1039, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_7);
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
__Pyx_Raise(__pyx_t_7, 0, 0, 0);
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
__PYX_ERR(0, 1039, __pyx_L1_error)
}
1040:
1041:
1042:
1043: # --------------- clm_srate ---------------- #
1044:
1045:
+1046: cpdef cython.double clm_srate(obj):
static PyObject *__pyx_pw_8pysndlib_3clm_31clm_srate(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static double __pyx_f_8pysndlib_3clm_clm_srate(PyObject *__pyx_v_obj, CYTHON_UNUSED int __pyx_skip_dispatch) {
double __pyx_r;
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_AddTraceback("pysndlib.clm.clm_srate", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = -1;
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_31clm_srate(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_8pysndlib_3clm_31clm_srate = {"clm_srate", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_31clm_srate, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_8pysndlib_3clm_31clm_srate(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
PyObject *__pyx_v_obj = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("clm_srate (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_obj,0};
PyObject* values[1] = {0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_obj)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1046, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "clm_srate") < 0)) __PYX_ERR(0, 1046, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 1)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
}
__pyx_v_obj = values[0];
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("clm_srate", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 1046, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.clm_srate", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_8pysndlib_3clm_30clm_srate(__pyx_self, __pyx_v_obj);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_30clm_srate(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_obj) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8pysndlib_3clm_clm_srate(__pyx_v_obj, 0); if (unlikely(__pyx_t_1 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1046, __pyx_L1_error)
__pyx_t_2 = PyFloat_FromDouble(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1046, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("pysndlib.clm.clm_srate", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_43 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_31clm_srate, 0, __pyx_n_s_clm_srate, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__164)); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 1046, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_clm_srate, __pyx_t_43) < 0) __PYX_ERR(0, 1046, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
/* … */
__pyx_codeobj__164 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__157, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_clm_srate, 1046, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__164)) __PYX_ERR(0, 1046, __pyx_L1_error)
+1047: return csndlib.mus_sound_srate(obj)
__pyx_t_1 = __Pyx_PyObject_AsString(__pyx_v_obj); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) __PYX_ERR(0, 1047, __pyx_L1_error) __pyx_r = mus_sound_srate(__pyx_t_1); goto __pyx_L0;
1048:
1049: # --------------- clm_framples ---------------- #
1050:
+1051: cpdef cython.long clm_framples(obj):
static PyObject *__pyx_pw_8pysndlib_3clm_33clm_framples(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static long __pyx_f_8pysndlib_3clm_clm_framples(PyObject *__pyx_v_obj, CYTHON_UNUSED int __pyx_skip_dispatch) {
long __pyx_r;
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_6);
__Pyx_XDECREF(__pyx_t_7);
__Pyx_AddTraceback("pysndlib.clm.clm_framples", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = -1;
__pyx_L0:;
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_33clm_framples(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_8pysndlib_3clm_33clm_framples = {"clm_framples", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_33clm_framples, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_8pysndlib_3clm_33clm_framples(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
PyObject *__pyx_v_obj = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("clm_framples (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_obj,0};
PyObject* values[1] = {0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_obj)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1051, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "clm_framples") < 0)) __PYX_ERR(0, 1051, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 1)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
}
__pyx_v_obj = values[0];
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("clm_framples", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 1051, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.clm_framples", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_8pysndlib_3clm_32clm_framples(__pyx_self, __pyx_v_obj);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_32clm_framples(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_obj) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8pysndlib_3clm_clm_framples(__pyx_v_obj, 0); if (unlikely(__pyx_t_1 == ((long)-1) && PyErr_Occurred())) __PYX_ERR(0, 1051, __pyx_L1_error)
__pyx_t_2 = __Pyx_PyInt_From_long(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1051, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("pysndlib.clm.clm_framples", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_43 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_33clm_framples, 0, __pyx_n_s_clm_framples, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__165)); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 1051, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_clm_framples, __pyx_t_43) < 0) __PYX_ERR(0, 1051, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
/* … */
__pyx_codeobj__165 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__157, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_clm_framples, 1051, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__165)) __PYX_ERR(0, 1051, __pyx_L1_error)
+1052: if isinstance(obj, str):
__pyx_t_1 = PyString_Check(__pyx_v_obj);
if (__pyx_t_1) {
/* … */
}
+1053: return csndlib.mus_sound_framples(obj)
__pyx_t_2 = __Pyx_PyObject_AsString(__pyx_v_obj); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 1053, __pyx_L1_error) __pyx_r = mus_sound_framples(__pyx_t_2); goto __pyx_L0;
+1054: elif isinstance(obj, mus_any):
__pyx_t_1 = __Pyx_TypeCheck(__pyx_v_obj, __pyx_ptype_8pysndlib_3clm_mus_any);
if (__pyx_t_1) {
/* … */
}
+1055: return obj.mus_length
__pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_obj, __pyx_n_s_mus_length); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1055, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = __Pyx_PyInt_As_long(__pyx_t_3); if (unlikely((__pyx_t_4 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 1055, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_r = __pyx_t_4; goto __pyx_L0;
+1056: elif isinstance(obj, list):
__pyx_t_1 = PyList_Check(__pyx_v_obj);
if (__pyx_t_1) {
/* … */
}
+1057: if isinstance(obj[0], list):
__pyx_t_3 = __Pyx_GetItemInt(__pyx_v_obj, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1057, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_1 = PyList_Check(__pyx_t_3); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_1) { /* … */ }
+1058: return len(obj[0])
__pyx_t_3 = __Pyx_GetItemInt(__pyx_v_obj, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1058, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = PyObject_Length(__pyx_t_3); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1058, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_r = __pyx_t_5; goto __pyx_L0;
1059: else:
+1060: return len(obj)
/*else*/ {
__pyx_t_5 = PyObject_Length(__pyx_v_obj); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1060, __pyx_L1_error)
__pyx_r = __pyx_t_5;
goto __pyx_L0;
}
+1061: elif isinstance(obj, np.ndarray):
__pyx_t_1 = __Pyx_TypeCheck(__pyx_v_obj, __pyx_ptype_5numpy_ndarray);
if (likely(__pyx_t_1)) {
/* … */
}
+1062: if obj.ndim == 1:
__pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_obj, __pyx_n_s_ndim); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1062, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_1 = (__Pyx_PyInt_BoolEqObjC(__pyx_t_3, __pyx_int_1, 1, 0)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 1062, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_1) { /* … */ }
+1063: return np.shape(obj)[0]
__Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1063, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_shape); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1063, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_6 = NULL; __pyx_t_8 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_7))) { __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_7); if (likely(__pyx_t_6)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7); __Pyx_INCREF(__pyx_t_6); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_7, function); __pyx_t_8 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_v_obj}; __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_7, __pyx_callargs+1-__pyx_t_8, 1+__pyx_t_8); __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1063, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; } __pyx_t_7 = __Pyx_GetItemInt(__pyx_t_3, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1063, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_4 = __Pyx_PyInt_As_long(__pyx_t_7); if (unlikely((__pyx_t_4 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 1063, __pyx_L1_error) __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_r = __pyx_t_4; goto __pyx_L0;
+1064: elif obj.ndim == 2:
__pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_obj, __pyx_n_s_ndim); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1064, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_1 = (__Pyx_PyInt_BoolEqObjC(__pyx_t_7, __pyx_int_2, 2, 0)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 1064, __pyx_L1_error) __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; if (likely(__pyx_t_1)) { /* … */ }
+1065: return np.shape(obj)[1]
__Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1065, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_shape); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1065, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = NULL; __pyx_t_8 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_6))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_6); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_6, function); __pyx_t_8 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v_obj}; __pyx_t_7 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+1-__pyx_t_8, 1+__pyx_t_8); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1065, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; } __pyx_t_6 = __Pyx_GetItemInt(__pyx_t_7, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1065, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_4 = __Pyx_PyInt_As_long(__pyx_t_6); if (unlikely((__pyx_t_4 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 1065, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_r = __pyx_t_4; goto __pyx_L0;
1066: else:
+1067: raise RuntimeError(f'ndarray must have 1 or 2 dimensions not {obj.ndim}. ')
/*else*/ {
__pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1067, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_6);
__pyx_t_5 = 0;
__pyx_t_9 = 127;
__Pyx_INCREF(__pyx_kp_u_ndarray_must_have_1_or_2_dimensi);
__pyx_t_5 += 40;
__Pyx_GIVEREF(__pyx_kp_u_ndarray_must_have_1_or_2_dimensi);
PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_kp_u_ndarray_must_have_1_or_2_dimensi);
__pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_obj, __pyx_n_s_ndim); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1067, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_7);
__pyx_t_3 = __Pyx_PyObject_FormatSimple(__pyx_t_7, __pyx_empty_unicode); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1067, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
__pyx_t_9 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3) > __pyx_t_9) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3) : __pyx_t_9;
__pyx_t_5 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3);
__Pyx_GIVEREF(__pyx_t_3);
PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_3);
__pyx_t_3 = 0;
__Pyx_INCREF(__pyx_kp_u__13);
__pyx_t_5 += 2;
__Pyx_GIVEREF(__pyx_kp_u__13);
PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_kp_u__13);
__pyx_t_3 = __Pyx_PyUnicode_Join(__pyx_t_6, 3, __pyx_t_5, __pyx_t_9); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1067, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
__pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_builtin_RuntimeError, __pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1067, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_6);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_Raise(__pyx_t_6, 0, 0, 0);
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
__PYX_ERR(0, 1067, __pyx_L1_error)
}
1068: else:
+1069: raise RuntimeError(f'object {obj} has no meaningful framples. ')
/*else*/ {
__pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1069, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_6);
__pyx_t_5 = 0;
__pyx_t_9 = 127;
__Pyx_INCREF(__pyx_kp_u_object_2);
__pyx_t_5 += 7;
__Pyx_GIVEREF(__pyx_kp_u_object_2);
PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_kp_u_object_2);
__pyx_t_3 = __Pyx_PyObject_FormatSimple(__pyx_v_obj, __pyx_empty_unicode); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1069, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_9 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3) > __pyx_t_9) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3) : __pyx_t_9;
__pyx_t_5 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3);
__Pyx_GIVEREF(__pyx_t_3);
PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_3);
__pyx_t_3 = 0;
__Pyx_INCREF(__pyx_kp_u_has_no_meaningful_framples);
__pyx_t_5 += 29;
__Pyx_GIVEREF(__pyx_kp_u_has_no_meaningful_framples);
PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_kp_u_has_no_meaningful_framples);
__pyx_t_3 = __Pyx_PyUnicode_Join(__pyx_t_6, 3, __pyx_t_5, __pyx_t_9); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1069, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
__pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_builtin_RuntimeError, __pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1069, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_6);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_Raise(__pyx_t_6, 0, 0, 0);
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
__PYX_ERR(0, 1069, __pyx_L1_error)
}
1070:
1071: # --------------- clm random ---------------- #
1072:
+1073: cpdef cython.double clm_random(cython.double x=1.0):
static PyObject *__pyx_pw_8pysndlib_3clm_35clm_random(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static double __pyx_f_8pysndlib_3clm_clm_random(CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_8pysndlib_3clm_clm_random *__pyx_optional_args) {
double __pyx_v_x = ((double)1.0);
double __pyx_r;
if (__pyx_optional_args) {
if (__pyx_optional_args->__pyx_n > 0) {
__pyx_v_x = __pyx_optional_args->x;
}
}
/* … */
/* function exit code */
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_35clm_random(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_8pysndlib_3clm_35clm_random = {"clm_random", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_35clm_random, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_8pysndlib_3clm_35clm_random(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
double __pyx_v_x;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("clm_random (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,0};
PyObject* values[1] = {0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_x);
if (value) { values[0] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1073, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "clm_random") < 0)) __PYX_ERR(0, 1073, __pyx_L3_error)
}
} else {
switch (__pyx_nargs) {
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
}
if (values[0]) {
__pyx_v_x = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_x == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1073, __pyx_L3_error)
} else {
__pyx_v_x = ((double)1.0);
}
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("clm_random", 0, 0, 1, __pyx_nargs); __PYX_ERR(0, 1073, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.clm_random", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_8pysndlib_3clm_34clm_random(__pyx_self, __pyx_v_x);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_34clm_random(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_x) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_2.__pyx_n = 1;
__pyx_t_2.x = __pyx_v_x;
__pyx_t_1 = __pyx_f_8pysndlib_3clm_clm_random(0, &__pyx_t_2); if (unlikely(__pyx_t_1 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1073, __pyx_L1_error)
__pyx_t_3 = PyFloat_FromDouble(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1073, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__pyx_r = __pyx_t_3;
__pyx_t_3 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_3);
__Pyx_AddTraceback("pysndlib.clm.clm_random", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_codeobj__166 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__151, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_clm_random, 1073, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__166)) __PYX_ERR(0, 1073, __pyx_L1_error)
/* … */
__pyx_t_43 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_35clm_random, 0, __pyx_n_s_clm_random, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__166)); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 1073, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
__Pyx_CyFunction_SetDefaultsTuple(__pyx_t_43, __pyx_tuple__167);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_clm_random, __pyx_t_43) < 0) __PYX_ERR(0, 1073, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
__pyx_tuple__167 = PyTuple_Pack(1, __pyx_float_1_0); if (unlikely(!__pyx_tuple__167)) __PYX_ERR(0, 1073, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__167);
__Pyx_GIVEREF(__pyx_tuple__167);
+1074: return cclm.mus_random(x)
__pyx_r = mus_random(__pyx_v_x); goto __pyx_L0;
1075: # --------------- just some extra utils ---------------- #
1076:
+1077: def validate_envelope(e):
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_37validate_envelope(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_8pysndlib_3clm_37validate_envelope = {"validate_envelope", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_37validate_envelope, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_8pysndlib_3clm_37validate_envelope(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
PyObject *__pyx_v_e = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("validate_envelope (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_e,0};
PyObject* values[1] = {0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_e)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1077, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "validate_envelope") < 0)) __PYX_ERR(0, 1077, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 1)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
}
__pyx_v_e = values[0];
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("validate_envelope", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 1077, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.validate_envelope", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_8pysndlib_3clm_36validate_envelope(__pyx_self, __pyx_v_e);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_gb_8pysndlib_3clm_17validate_envelope_2generator1(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */
/* … */
static PyObject *__pyx_pf_8pysndlib_3clm_36validate_envelope(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_e) {
PyObject *__pyx_7genexpr__pyx_v_i = NULL;
PyObject *__pyx_gb_8pysndlib_3clm_17validate_envelope_2generator1 = 0;
PyObject *__pyx_r = NULL;
/* … */
/* function exit code */
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_XDECREF(__pyx_t_6);
__Pyx_AddTraceback("pysndlib.clm.validate_envelope", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XDECREF(__pyx_7genexpr__pyx_v_i);
__Pyx_XDECREF(__pyx_gb_8pysndlib_3clm_17validate_envelope_2generator1);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_tuple__168 = PyTuple_Pack(4, __pyx_n_s_e, __pyx_n_s_i, __pyx_n_s_genexpr, __pyx_n_s_genexpr); if (unlikely(!__pyx_tuple__168)) __PYX_ERR(0, 1077, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__168);
__Pyx_GIVEREF(__pyx_tuple__168);
/* … */
__pyx_t_43 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_37validate_envelope, 0, __pyx_n_s_validate_envelope, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__169)); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 1077, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_validate_envelope, __pyx_t_43) < 0) __PYX_ERR(0, 1077, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
__pyx_codeobj__169 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__168, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_validate_envelope, 1077, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__169)) __PYX_ERR(0, 1077, __pyx_L1_error)
1078: # is env even number length
+1079: if len(e) < 2:
__pyx_t_1 = PyObject_Length(__pyx_v_e); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1079, __pyx_L1_error) __pyx_t_2 = (__pyx_t_1 < 2); if (unlikely(__pyx_t_2)) { /* … */ }
+1080: raise RuntimeError("a valid envelope needs at least 2 elements")
__pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__19, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1080, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __PYX_ERR(0, 1080, __pyx_L1_error) /* … */ __pyx_tuple__19 = PyTuple_Pack(1, __pyx_kp_s_a_valid_envelope_needs_at_least); if (unlikely(!__pyx_tuple__19)) __PYX_ERR(0, 1080, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__19); __Pyx_GIVEREF(__pyx_tuple__19);
+1081: if len(e) % 2 != 0:
__pyx_t_1 = PyObject_Length(__pyx_v_e); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1081, __pyx_L1_error) __pyx_t_2 = (__Pyx_mod_Py_ssize_t(__pyx_t_1, 2) != 0); if (unlikely(__pyx_t_2)) { /* … */ }
+1082: raise RuntimeError("a valid envelope needs even number of elements. This has {len(e)}")
__pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__20, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1082, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __PYX_ERR(0, 1082, __pyx_L1_error) /* … */ __pyx_tuple__20 = PyTuple_Pack(1, __pyx_kp_s_a_valid_envelope_needs_even_numb); if (unlikely(!__pyx_tuple__20)) __PYX_ERR(0, 1082, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__20); __Pyx_GIVEREF(__pyx_tuple__20);
+1083: if isinstance(e, list):
__pyx_t_2 = PyList_Check(__pyx_v_e);
if (__pyx_t_2) {
/* … */
}
+1084: if all([isinstance(i, int | float) for i in e]):
{ /* enter inner scope */
__pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1084, __pyx_L9_error)
__Pyx_GOTREF(__pyx_t_3);
if (likely(PyList_CheckExact(__pyx_v_e)) || PyTuple_CheckExact(__pyx_v_e)) {
__pyx_t_4 = __pyx_v_e; __Pyx_INCREF(__pyx_t_4);
__pyx_t_1 = 0;
__pyx_t_5 = NULL;
} else {
__pyx_t_1 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_e); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1084, __pyx_L9_error)
__Pyx_GOTREF(__pyx_t_4);
__pyx_t_5 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1084, __pyx_L9_error)
}
for (;;) {
if (likely(!__pyx_t_5)) {
if (likely(PyList_CheckExact(__pyx_t_4))) {
{
Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_4);
#if !CYTHON_ASSUME_SAFE_MACROS
if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 1084, __pyx_L9_error)
#endif
if (__pyx_t_1 >= __pyx_temp) break;
}
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
__pyx_t_6 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_1); __Pyx_INCREF(__pyx_t_6); __pyx_t_1++; if (unlikely((0 < 0))) __PYX_ERR(0, 1084, __pyx_L9_error)
#else
__pyx_t_6 = __Pyx_PySequence_ITEM(__pyx_t_4, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1084, __pyx_L9_error)
__Pyx_GOTREF(__pyx_t_6);
#endif
} else {
{
Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_4);
#if !CYTHON_ASSUME_SAFE_MACROS
if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 1084, __pyx_L9_error)
#endif
if (__pyx_t_1 >= __pyx_temp) break;
}
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
__pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_1); __Pyx_INCREF(__pyx_t_6); __pyx_t_1++; if (unlikely((0 < 0))) __PYX_ERR(0, 1084, __pyx_L9_error)
#else
__pyx_t_6 = __Pyx_PySequence_ITEM(__pyx_t_4, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1084, __pyx_L9_error)
__Pyx_GOTREF(__pyx_t_6);
#endif
}
} else {
__pyx_t_6 = __pyx_t_5(__pyx_t_4);
if (unlikely(!__pyx_t_6)) {
PyObject* exc_type = PyErr_Occurred();
if (exc_type) {
if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
else __PYX_ERR(0, 1084, __pyx_L9_error)
}
break;
}
__Pyx_GOTREF(__pyx_t_6);
}
__Pyx_XDECREF_SET(__pyx_7genexpr__pyx_v_i, __pyx_t_6);
__pyx_t_6 = 0;
__pyx_t_6 = PyNumber_Or(((PyObject *)(&PyInt_Type)), ((PyObject *)(&PyFloat_Type))); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1084, __pyx_L9_error)
__Pyx_GOTREF((PyObject *)__pyx_t_6);
__pyx_t_2 = __Pyx_TypeCheck(__pyx_7genexpr__pyx_v_i, __pyx_t_6);
__Pyx_DECREF((PyObject *)__pyx_t_6); __pyx_t_6 = 0;
__pyx_t_6 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1084, __pyx_L9_error)
__Pyx_GOTREF(__pyx_t_6);
if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_t_6))) __PYX_ERR(0, 1084, __pyx_L9_error)
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_XDECREF(__pyx_7genexpr__pyx_v_i); __pyx_7genexpr__pyx_v_i = 0;
goto __pyx_L13_exit_scope;
__pyx_L9_error:;
__Pyx_XDECREF(__pyx_7genexpr__pyx_v_i); __pyx_7genexpr__pyx_v_i = 0;
goto __pyx_L1_error;
__pyx_L13_exit_scope:;
} /* exit inner scope */
__pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_all, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1084, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 1084, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
if (unlikely(__pyx_t_2)) {
/* … */
}
+1085: raise RuntimeError("a valid envelope can only contain numbers.")
__pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__21, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1085, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __PYX_ERR(0, 1085, __pyx_L1_error) /* … */ __pyx_tuple__21 = PyTuple_Pack(1, __pyx_kp_s_a_valid_envelope_can_only_contai); if (unlikely(!__pyx_tuple__21)) __PYX_ERR(0, 1085, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__21); __Pyx_GIVEREF(__pyx_tuple__21);
+1086: if not all(i < j for i, j in zip(e[: : 2], e[2: : 2])):
static PyObject *__pyx_pf_8pysndlib_3clm_17validate_envelope_genexpr(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_genexpr_arg_0) {
struct __pyx_obj_8pysndlib_3clm___pyx_scope_struct__genexpr *__pyx_cur_scope;
PyObject *__pyx_r = NULL;
__pyx_cur_scope = (struct __pyx_obj_8pysndlib_3clm___pyx_scope_struct__genexpr *)__pyx_tp_new_8pysndlib_3clm___pyx_scope_struct__genexpr(__pyx_ptype_8pysndlib_3clm___pyx_scope_struct__genexpr, __pyx_empty_tuple, NULL);
if (unlikely(!__pyx_cur_scope)) {
__pyx_cur_scope = ((struct __pyx_obj_8pysndlib_3clm___pyx_scope_struct__genexpr *)Py_None);
__Pyx_INCREF(Py_None);
__PYX_ERR(0, 1086, __pyx_L1_error)
} else {
__Pyx_GOTREF((PyObject *)__pyx_cur_scope);
}
__pyx_cur_scope->__pyx_genexpr_arg_0 = __pyx_genexpr_arg_0;
__Pyx_INCREF(__pyx_cur_scope->__pyx_genexpr_arg_0);
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_genexpr_arg_0);
{
__pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_8pysndlib_3clm_17validate_envelope_2generator1, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_validate_envelope_locals_genexpr, __pyx_n_s_pysndlib_clm); if (unlikely(!gen)) __PYX_ERR(0, 1086, __pyx_L1_error)
__Pyx_DECREF(__pyx_cur_scope);
__Pyx_RefNannyFinishContext();
return (PyObject *) gen;
}
/* function exit code */
__pyx_L1_error:;
__Pyx_AddTraceback("pysndlib.clm.validate_envelope.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__Pyx_DECREF((PyObject *)__pyx_cur_scope);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_gb_8pysndlib_3clm_17validate_envelope_2generator1(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("genexpr", 0);
__pyx_L3_first_run:;
if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 1086, __pyx_L1_error)
if (unlikely(!__pyx_cur_scope->__pyx_genexpr_arg_0)) { __Pyx_RaiseUnboundLocalError(".0"); __PYX_ERR(0, 1086, __pyx_L1_error) }
if (likely(PyList_CheckExact(__pyx_cur_scope->__pyx_genexpr_arg_0)) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_genexpr_arg_0)) {
__pyx_t_1 = __pyx_cur_scope->__pyx_genexpr_arg_0; __Pyx_INCREF(__pyx_t_1);
__pyx_t_2 = 0;
__pyx_t_3 = NULL;
} else {
__pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_cur_scope->__pyx_genexpr_arg_0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1086, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_3 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1086, __pyx_L1_error)
}
for (;;) {
if (likely(!__pyx_t_3)) {
if (likely(PyList_CheckExact(__pyx_t_1))) {
{
Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1);
#if !CYTHON_ASSUME_SAFE_MACROS
if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 1086, __pyx_L1_error)
#endif
if (__pyx_t_2 >= __pyx_temp) break;
}
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
__pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely((0 < 0))) __PYX_ERR(0, 1086, __pyx_L1_error)
#else
__pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1086, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
#endif
} else {
{
Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1);
#if !CYTHON_ASSUME_SAFE_MACROS
if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 1086, __pyx_L1_error)
#endif
if (__pyx_t_2 >= __pyx_temp) break;
}
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
__pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely((0 < 0))) __PYX_ERR(0, 1086, __pyx_L1_error)
#else
__pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1086, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
#endif
}
} else {
__pyx_t_4 = __pyx_t_3(__pyx_t_1);
if (unlikely(!__pyx_t_4)) {
PyObject* exc_type = PyErr_Occurred();
if (exc_type) {
if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
else __PYX_ERR(0, 1086, __pyx_L1_error)
}
break;
}
__Pyx_GOTREF(__pyx_t_4);
}
if ((likely(PyTuple_CheckExact(__pyx_t_4))) || (PyList_CheckExact(__pyx_t_4))) {
PyObject* sequence = __pyx_t_4;
Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
if (unlikely(size != 2)) {
if (size > 2) __Pyx_RaiseTooManyValuesError(2);
else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
__PYX_ERR(0, 1086, __pyx_L1_error)
}
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
if (likely(PyTuple_CheckExact(sequence))) {
__pyx_t_5 = PyTuple_GET_ITEM(sequence, 0);
__pyx_t_6 = PyTuple_GET_ITEM(sequence, 1);
} else {
__pyx_t_5 = PyList_GET_ITEM(sequence, 0);
__pyx_t_6 = PyList_GET_ITEM(sequence, 1);
}
__Pyx_INCREF(__pyx_t_5);
__Pyx_INCREF(__pyx_t_6);
#else
__pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1086, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_5);
__pyx_t_6 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1086, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_6);
#endif
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
} else {
Py_ssize_t index = -1;
__pyx_t_7 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1086, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_7);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__pyx_t_8 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_7);
index = 0; __pyx_t_5 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_5)) goto __pyx_L6_unpacking_failed;
__Pyx_GOTREF(__pyx_t_5);
index = 1; __pyx_t_6 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_6)) goto __pyx_L6_unpacking_failed;
__Pyx_GOTREF(__pyx_t_6);
if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < 0) __PYX_ERR(0, 1086, __pyx_L1_error)
__pyx_t_8 = NULL;
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
goto __pyx_L7_unpacking_done;
__pyx_L6_unpacking_failed:;
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
__pyx_t_8 = NULL;
if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
__PYX_ERR(0, 1086, __pyx_L1_error)
__pyx_L7_unpacking_done:;
}
__Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_i);
__Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_i, __pyx_t_5);
__Pyx_GIVEREF(__pyx_t_5);
__pyx_t_5 = 0;
__Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_j);
__Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_j, __pyx_t_6);
__Pyx_GIVEREF(__pyx_t_6);
__pyx_t_6 = 0;
__pyx_t_4 = PyObject_RichCompare(__pyx_cur_scope->__pyx_v_i, __pyx_cur_scope->__pyx_v_j, Py_LT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1086, __pyx_L1_error)
__pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_9 < 0))) __PYX_ERR(0, 1086, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__pyx_t_10 = (!__pyx_t_9);
if (__pyx_t_10) {
__Pyx_XDECREF(__pyx_r);
__Pyx_INCREF(Py_False);
__pyx_r = Py_False;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
goto __pyx_L0;
}
}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
/*else*/ {
__Pyx_XDECREF(__pyx_r);
__Pyx_INCREF(Py_True);
__pyx_r = Py_True;
goto __pyx_L0;
}
CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_Generator_Replace_StopIteration(0);
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_XDECREF(__pyx_t_5);
__Pyx_XDECREF(__pyx_t_6);
__Pyx_XDECREF(__pyx_t_7);
__Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
#if !CYTHON_USE_EXC_INFO_STACK
__Pyx_Coroutine_ResetAndClearException(__pyx_generator);
#endif
__pyx_generator->resume_label = -1;
__Pyx_Coroutine_clear((PyObject*)__pyx_generator);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_4 = __Pyx_PyObject_GetItem(__pyx_v_e, __pyx_slice__18); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1086, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
__pyx_t_3 = __Pyx_PyObject_GetItem(__pyx_v_e, __pyx_slice__22); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1086, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1086, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_6);
__Pyx_GIVEREF(__pyx_t_4);
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4)) __PYX_ERR(0, 1086, __pyx_L1_error);
__Pyx_GIVEREF(__pyx_t_3);
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_3)) __PYX_ERR(0, 1086, __pyx_L1_error);
__pyx_t_4 = 0;
__pyx_t_3 = 0;
__pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_zip, __pyx_t_6, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1086, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
__pyx_t_6 = __pyx_pf_8pysndlib_3clm_17validate_envelope_genexpr(NULL, __pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1086, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_6);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_3 = __Pyx_Generator_Next(__pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1086, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
__pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 1086, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_7 = (!__pyx_t_2);
if (unlikely(__pyx_t_7)) {
/* … */
__pyx_slice__22 = PySlice_New(__pyx_int_2, Py_None, __pyx_int_2); if (unlikely(!__pyx_slice__22)) __PYX_ERR(0, 1086, __pyx_L1_error)
__Pyx_GOTREF(__pyx_slice__22);
__Pyx_GIVEREF(__pyx_slice__22);
/* … */
}
/* … */
struct __pyx_obj_8pysndlib_3clm___pyx_scope_struct__genexpr {
PyObject_HEAD
PyObject *__pyx_genexpr_arg_0;
PyObject *__pyx_v_i;
PyObject *__pyx_v_j;
};
+1087: raise RuntimeError("x values of envelope must be increasing")
__pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__23, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1087, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __PYX_ERR(0, 1087, __pyx_L1_error) /* … */ __pyx_tuple__23 = PyTuple_Pack(1, __pyx_kp_s_x_values_of_envelope_must_be_inc); if (unlikely(!__pyx_tuple__23)) __PYX_ERR(0, 1087, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__23); __Pyx_GIVEREF(__pyx_tuple__23);
1088:
1089:
+1090: cpdef bint is_zero(cython.numeric x):
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_39is_zero(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_8pysndlib_3clm_39is_zero = {"is_zero", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_8pysndlib_3clm_39is_zero, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_8pysndlib_3clm_39is_zero(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_signatures = 0;
PyObject *__pyx_v_args = 0;
PyObject *__pyx_v_kwargs = 0;
CYTHON_UNUSED PyObject *__pyx_v_defaults = 0;
PyObject *__pyx_v__fused_sigindex = 0;
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__pyx_fused_cpdef (wrapper)", 0);
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_signatures,&__pyx_n_s_args,&__pyx_n_s_kwargs,&__pyx_n_s_defaults,&__pyx_n_s_fused_sigindex,0};
PyObject* values[5] = {0,0,0,0,0};
__pyx_defaults1 *__pyx_dynamic_args = __Pyx_CyFunction_Defaults(__pyx_defaults1, __pyx_self);
values[4] = __Pyx_Arg_NewRef_VARARGS(__pyx_dynamic_args->__pyx_arg__fused_sigindex);
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 5: values[4] = __Pyx_Arg_VARARGS(__pyx_args, 4);
CYTHON_FALLTHROUGH;
case 4: values[3] = __Pyx_Arg_VARARGS(__pyx_args, 3);
CYTHON_FALLTHROUGH;
case 3: values[2] = __Pyx_Arg_VARARGS(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = __Pyx_Arg_VARARGS(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_VARARGS(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_signatures)) != 0)) {
(void)__Pyx_Arg_NewRef_VARARGS(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1090, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (likely((values[1] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_args)) != 0)) {
(void)__Pyx_Arg_NewRef_VARARGS(values[1]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1090, __pyx_L3_error)
else {
__Pyx_RaiseArgtupleInvalid("__pyx_fused_cpdef", 0, 4, 5, 1); __PYX_ERR(0, 1090, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 2:
if (likely((values[2] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_kwargs)) != 0)) {
(void)__Pyx_Arg_NewRef_VARARGS(values[2]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1090, __pyx_L3_error)
else {
__Pyx_RaiseArgtupleInvalid("__pyx_fused_cpdef", 0, 4, 5, 2); __PYX_ERR(0, 1090, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 3:
if (likely((values[3] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_defaults)) != 0)) {
(void)__Pyx_Arg_NewRef_VARARGS(values[3]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1090, __pyx_L3_error)
else {
__Pyx_RaiseArgtupleInvalid("__pyx_fused_cpdef", 0, 4, 5, 3); __PYX_ERR(0, 1090, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 4:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_fused_sigindex);
if (value) { values[4] = __Pyx_Arg_NewRef_VARARGS(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1090, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__pyx_fused_cpdef") < 0)) __PYX_ERR(0, 1090, __pyx_L3_error)
}
} else {
switch (__pyx_nargs) {
case 5: values[4] = __Pyx_Arg_VARARGS(__pyx_args, 4);
CYTHON_FALLTHROUGH;
case 4: values[3] = __Pyx_Arg_VARARGS(__pyx_args, 3);
values[2] = __Pyx_Arg_VARARGS(__pyx_args, 2);
values[1] = __Pyx_Arg_VARARGS(__pyx_args, 1);
values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
break;
default: goto __pyx_L5_argtuple_error;
}
}
__pyx_v_signatures = values[0];
__pyx_v_args = values[1];
__pyx_v_kwargs = values[2];
__pyx_v_defaults = values[3];
__pyx_v__fused_sigindex = values[4];
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("__pyx_fused_cpdef", 0, 4, 5, __pyx_nargs); __PYX_ERR(0, 1090, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.__pyx_fused_cpdef", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_8pysndlib_3clm_38is_zero(__pyx_self, __pyx_v_signatures, __pyx_v_args, __pyx_v_kwargs, __pyx_v_defaults, __pyx_v__fused_sigindex);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_38is_zero(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_signatures, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs, CYTHON_UNUSED PyObject *__pyx_v_defaults, PyObject *__pyx_v__fused_sigindex) {
PyObject *__pyx_v_search_list = 0;
PyObject *__pyx_v_sn = 0;
PyObject *__pyx_v_sigindex_node = 0;
PyObject *__pyx_v_dest_sig = NULL;
PyObject *__pyx_v_arg = NULL;
PyObject *__pyx_v_sig = NULL;
PyObject *__pyx_v_sig_series = NULL;
PyObject *__pyx_v_last_type = NULL;
PyObject *__pyx_v_sig_type = NULL;
PyObject *__pyx_v_sigindex_matches = NULL;
PyObject *__pyx_v_sigindex_candidates = NULL;
PyObject *__pyx_v_dst_type = NULL;
PyObject *__pyx_v_found_matches = NULL;
PyObject *__pyx_v_found_candidates = NULL;
PyObject *__pyx_v_candidates = NULL;
PyObject *__pyx_r = NULL;
__Pyx_INCREF(__pyx_v_kwargs);
__pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1090, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__Pyx_INCREF(Py_None);
__Pyx_GIVEREF(Py_None);
if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 0, Py_None)) __PYX_ERR(0, 1090, __pyx_L1_error);
__pyx_v_dest_sig = ((PyObject*)__pyx_t_1);
__pyx_t_1 = 0;
__pyx_t_3 = (__pyx_v_kwargs != Py_None);
if (__pyx_t_3) {
} else {
__pyx_t_2 = __pyx_t_3;
goto __pyx_L4_bool_binop_done;
}
__pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_kwargs); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 1090, __pyx_L1_error)
__pyx_t_4 = (!__pyx_t_3);
__pyx_t_2 = __pyx_t_4;
__pyx_L4_bool_binop_done:;
if (__pyx_t_2) {
__Pyx_INCREF(Py_None);
__Pyx_DECREF_SET(__pyx_v_kwargs, Py_None);
}
if (unlikely(__pyx_v_args == Py_None)) {
PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
__PYX_ERR(0, 1090, __pyx_L1_error)
}
__pyx_t_5 = __Pyx_PyTuple_GET_SIZE(((PyObject*)__pyx_v_args)); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1090, __pyx_L1_error)
__pyx_t_2 = (0 < __pyx_t_5);
if (__pyx_t_2) {
if (unlikely(__pyx_v_args == Py_None)) {
PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
__PYX_ERR(0, 1090, __pyx_L1_error)
}
__pyx_t_1 = __Pyx_GetItemInt_Tuple(((PyObject*)__pyx_v_args), 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1090, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_v_arg = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L6;
}
__pyx_t_4 = (__pyx_v_kwargs != Py_None);
if (__pyx_t_4) {
} else {
__pyx_t_2 = __pyx_t_4;
goto __pyx_L7_bool_binop_done;
}
if (unlikely(__pyx_v_kwargs == Py_None)) {
PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
__PYX_ERR(0, 1090, __pyx_L1_error)
}
__pyx_t_4 = (__Pyx_PyDict_ContainsTF(__pyx_n_s_x, ((PyObject*)__pyx_v_kwargs), Py_EQ)); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 1090, __pyx_L1_error)
__pyx_t_2 = __pyx_t_4;
__pyx_L7_bool_binop_done:;
if (likely(__pyx_t_2)) {
if (unlikely(__pyx_v_kwargs == Py_None)) {
PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
__PYX_ERR(0, 1090, __pyx_L1_error)
}
__pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject*)__pyx_v_kwargs), __pyx_n_s_x); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1090, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_v_arg = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L6;
}
/*else*/ {
if (unlikely(__pyx_v_args == Py_None)) {
PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
__PYX_ERR(0, 1090, __pyx_L1_error)
}
__pyx_t_5 = __Pyx_PyTuple_GET_SIZE(((PyObject*)__pyx_v_args)); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1090, __pyx_L1_error)
__pyx_t_1 = PyInt_FromSsize_t(__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1090, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1090, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_6);
__Pyx_INCREF(__pyx_int_1);
__Pyx_GIVEREF(__pyx_int_1);
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_int_1)) __PYX_ERR(0, 1090, __pyx_L1_error);
__Pyx_INCREF(__pyx_kp_s_);
__Pyx_GIVEREF(__pyx_kp_s_);
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_kp_s_)) __PYX_ERR(0, 1090, __pyx_L1_error);
__Pyx_GIVEREF(__pyx_t_1);
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_t_1)) __PYX_ERR(0, 1090, __pyx_L1_error);
__pyx_t_1 = 0;
__pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_Expected_at_least_d_argument_s_g, __pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1090, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
__pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1090, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_6);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_Raise(__pyx_t_6, 0, 0, 0);
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
__PYX_ERR(0, 1090, __pyx_L1_error)
}
__pyx_L6:;
while (1) {
__pyx_t_2 = PyFloat_Check(__pyx_v_arg);
if (__pyx_t_2) {
if (unlikely((__Pyx_SetItemInt(__pyx_v_dest_sig, 0, __pyx_n_s_double, long, 1, __Pyx_PyInt_From_long, 1, 0, 1) < 0))) __PYX_ERR(0, 1090, __pyx_L1_error)
goto __pyx_L10_break;
}
__pyx_t_4 = PyInt_Check(__pyx_v_arg);
if (!__pyx_t_4) {
} else {
__pyx_t_2 = __pyx_t_4;
goto __pyx_L13_bool_binop_done;
}
__pyx_t_4 = PyLong_Check(__pyx_v_arg);
__pyx_t_2 = __pyx_t_4;
__pyx_L13_bool_binop_done:;
if (__pyx_t_2) {
if (unlikely((__Pyx_SetItemInt(__pyx_v_dest_sig, 0, __pyx_n_s_long, long, 1, __Pyx_PyInt_From_long, 1, 0, 1) < 0))) __PYX_ERR(0, 1090, __pyx_L1_error)
goto __pyx_L10_break;
}
__pyx_t_2 = PyComplex_Check(__pyx_v_arg);
if (__pyx_t_2) {
if (unlikely((__Pyx_SetItemInt(__pyx_v_dest_sig, 0, __pyx_kp_s_double_complex, long, 1, __Pyx_PyInt_From_long, 1, 0, 1) < 0))) __PYX_ERR(0, 1090, __pyx_L1_error)
goto __pyx_L10_break;
}
if (unlikely((__Pyx_SetItemInt(__pyx_v_dest_sig, 0, Py_None, long, 1, __Pyx_PyInt_From_long, 1, 0, 1) < 0))) __PYX_ERR(0, 1090, __pyx_L1_error)
goto __pyx_L10_break;
}
__pyx_L10_break:;
__pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v__fused_sigindex); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 1090, __pyx_L1_error)
__pyx_t_4 = (!__pyx_t_2);
if (__pyx_t_4) {
__pyx_t_5 = 0;
if (unlikely(__pyx_v_signatures == Py_None)) {
PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
__PYX_ERR(0, 1090, __pyx_L1_error)
}
__pyx_t_1 = __Pyx_dict_iterator(((PyObject*)__pyx_v_signatures), 1, ((PyObject *)NULL), (&__pyx_t_7), (&__pyx_t_8)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1090, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_6);
__pyx_t_6 = __pyx_t_1;
__pyx_t_1 = 0;
while (1) {
__pyx_t_9 = __Pyx_dict_iter_next(__pyx_t_6, __pyx_t_7, &__pyx_t_5, &__pyx_t_1, NULL, NULL, __pyx_t_8);
if (unlikely(__pyx_t_9 == 0)) break;
if (unlikely(__pyx_t_9 == -1)) __PYX_ERR(0, 1090, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__Pyx_XDECREF_SET(__pyx_v_sig, __pyx_t_1);
__pyx_t_1 = 0;
if (!(likely(PyDict_CheckExact(__pyx_v__fused_sigindex))||((__pyx_v__fused_sigindex) == Py_None) || __Pyx_RaiseUnexpectedTypeError("dict", __pyx_v__fused_sigindex))) __PYX_ERR(0, 1090, __pyx_L1_error)
__pyx_t_1 = __pyx_v__fused_sigindex;
__Pyx_INCREF(__pyx_t_1);
__Pyx_XDECREF_SET(__pyx_v_sigindex_node, ((PyObject*)__pyx_t_1));
__pyx_t_1 = 0;
__pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_sig, __pyx_n_s_strip); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1090, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_11);
__pyx_t_12 = NULL;
__pyx_t_9 = 0;
#if CYTHON_UNPACK_METHODS
if (likely(PyMethod_Check(__pyx_t_11))) {
__pyx_t_12 = PyMethod_GET_SELF(__pyx_t_11);
if (likely(__pyx_t_12)) {
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11);
__Pyx_INCREF(__pyx_t_12);
__Pyx_INCREF(function);
__Pyx_DECREF_SET(__pyx_t_11, function);
__pyx_t_9 = 1;
}
}
#endif
{
PyObject *__pyx_callargs[2] = {__pyx_t_12, __pyx_kp_s__24};
__pyx_t_10 = __Pyx_PyObject_FastCall(__pyx_t_11, __pyx_callargs+1-__pyx_t_9, 1+__pyx_t_9);
__Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1090, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_10);
__Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
}
__pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_split); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1090, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_11);
__Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
__pyx_t_10 = NULL;
__pyx_t_9 = 0;
#if CYTHON_UNPACK_METHODS
if (likely(PyMethod_Check(__pyx_t_11))) {
__pyx_t_10 = PyMethod_GET_SELF(__pyx_t_11);
if (likely(__pyx_t_10)) {
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11);
__Pyx_INCREF(__pyx_t_10);
__Pyx_INCREF(function);
__Pyx_DECREF_SET(__pyx_t_11, function);
__pyx_t_9 = 1;
}
}
#endif
{
PyObject *__pyx_callargs[2] = {__pyx_t_10, __pyx_kp_s__25};
__pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_11, __pyx_callargs+1-__pyx_t_9, 1+__pyx_t_9);
__Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1090, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
}
__pyx_t_11 = __Pyx_PySequence_ListKeepNew(__pyx_t_1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1090, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_11);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_t_13 = PyList_GET_SIZE(__pyx_t_11);
if (unlikely(__pyx_t_13 < 1)) {
__Pyx_RaiseNeedMoreValuesError(0+__pyx_t_13); __PYX_ERR(0, 1090, __pyx_L1_error)
}
#if CYTHON_COMPILING_IN_CPYTHON
__pyx_t_10 = PyList_GET_ITEM(__pyx_t_11, __pyx_t_13-1);
((PyVarObject*)__pyx_t_11)->ob_size--;
#else
__pyx_t_10 = PySequence_ITEM(__pyx_t_11, __pyx_t_13-1);
#endif
__Pyx_GOTREF(__pyx_t_10);
#if !CYTHON_COMPILING_IN_CPYTHON
__pyx_t_12 = PySequence_GetSlice(__pyx_t_11, 0, __pyx_t_13-1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1090, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_12);
__Pyx_DECREF(__pyx_t_11);
__pyx_t_11 = __pyx_t_12; __pyx_t_12 = NULL;
#else
CYTHON_UNUSED_VAR(__pyx_t_12);
#endif
__Pyx_XDECREF_SET(__pyx_v_sig_series, ((PyObject*)__pyx_t_11));
__pyx_t_11 = 0;
__Pyx_XDECREF_SET(__pyx_v_last_type, __pyx_t_10);
__pyx_t_10 = 0;
__pyx_t_1 = __pyx_v_sig_series; __Pyx_INCREF(__pyx_t_1);
__pyx_t_13 = 0;
for (;;) {
{
Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1);
#if !CYTHON_ASSUME_SAFE_MACROS
if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 1090, __pyx_L1_error)
#endif
if (__pyx_t_13 >= __pyx_temp) break;
}
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
__pyx_t_10 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_13); __Pyx_INCREF(__pyx_t_10); __pyx_t_13++; if (unlikely((0 < 0))) __PYX_ERR(0, 1090, __pyx_L1_error)
#else
__pyx_t_10 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1090, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_10);
#endif
__Pyx_XDECREF_SET(__pyx_v_sig_type, __pyx_t_10);
__pyx_t_10 = 0;
if (unlikely(__pyx_v_sigindex_node == Py_None)) {
PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
__PYX_ERR(0, 1090, __pyx_L1_error)
}
__pyx_t_4 = (__Pyx_PyDict_ContainsTF(__pyx_v_sig_type, __pyx_v_sigindex_node, Py_NE)); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 1090, __pyx_L1_error)
if (__pyx_t_4) {
__pyx_t_10 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1090, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_10);
if (unlikely(__pyx_v_sigindex_node == Py_None)) {
PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
__PYX_ERR(0, 1090, __pyx_L1_error)
}
if (unlikely((PyDict_SetItem(__pyx_v_sigindex_node, __pyx_v_sig_type, __pyx_t_10) < 0))) __PYX_ERR(0, 1090, __pyx_L1_error)
__Pyx_INCREF(__pyx_t_10);
__Pyx_DECREF_SET(__pyx_v_sigindex_node, __pyx_t_10);
__Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
goto __pyx_L21;
}
/*else*/ {
if (unlikely(__pyx_v_sigindex_node == Py_None)) {
PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
__PYX_ERR(0, 1090, __pyx_L1_error)
}
__pyx_t_10 = __Pyx_PyDict_GetItem(__pyx_v_sigindex_node, __pyx_v_sig_type); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1090, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_10);
if (!(likely(PyDict_CheckExact(__pyx_t_10))||((__pyx_t_10) == Py_None) || __Pyx_RaiseUnexpectedTypeError("dict", __pyx_t_10))) __PYX_ERR(0, 1090, __pyx_L1_error)
__Pyx_DECREF_SET(__pyx_v_sigindex_node, ((PyObject*)__pyx_t_10));
__pyx_t_10 = 0;
}
__pyx_L21:;
}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
if (unlikely(__pyx_v_sigindex_node == Py_None)) {
PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
__PYX_ERR(0, 1090, __pyx_L1_error)
}
if (unlikely((PyDict_SetItem(__pyx_v_sigindex_node, __pyx_v_last_type, __pyx_v_sig) < 0))) __PYX_ERR(0, 1090, __pyx_L1_error)
}
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
}
__pyx_t_6 = PyList_New(0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1090, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_6);
__pyx_v_sigindex_matches = ((PyObject*)__pyx_t_6);
__pyx_t_6 = 0;
__pyx_t_6 = PyList_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1090, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_6);
__Pyx_INCREF(__pyx_v__fused_sigindex);
__Pyx_GIVEREF(__pyx_v__fused_sigindex);
if (__Pyx_PyList_SET_ITEM(__pyx_t_6, 0, __pyx_v__fused_sigindex)) __PYX_ERR(0, 1090, __pyx_L1_error);
__pyx_v_sigindex_candidates = ((PyObject*)__pyx_t_6);
__pyx_t_6 = 0;
__pyx_t_6 = __pyx_v_dest_sig; __Pyx_INCREF(__pyx_t_6);
__pyx_t_7 = 0;
for (;;) {
{
Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_6);
#if !CYTHON_ASSUME_SAFE_MACROS
if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 1090, __pyx_L1_error)
#endif
if (__pyx_t_7 >= __pyx_temp) break;
}
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
__pyx_t_1 = PyList_GET_ITEM(__pyx_t_6, __pyx_t_7); __Pyx_INCREF(__pyx_t_1); __pyx_t_7++; if (unlikely((0 < 0))) __PYX_ERR(0, 1090, __pyx_L1_error)
#else
__pyx_t_1 = __Pyx_PySequence_ITEM(__pyx_t_6, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1090, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
#endif
__Pyx_XDECREF_SET(__pyx_v_dst_type, __pyx_t_1);
__pyx_t_1 = 0;
__pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1090, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__Pyx_XDECREF_SET(__pyx_v_found_matches, ((PyObject*)__pyx_t_1));
__pyx_t_1 = 0;
__pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1090, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__Pyx_XDECREF_SET(__pyx_v_found_candidates, ((PyObject*)__pyx_t_1));
__pyx_t_1 = 0;
__pyx_t_4 = (__pyx_v_dst_type == Py_None);
if (__pyx_t_4) {
__pyx_t_1 = __pyx_v_sigindex_matches; __Pyx_INCREF(__pyx_t_1);
__pyx_t_5 = 0;
for (;;) {
{
Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1);
#if !CYTHON_ASSUME_SAFE_MACROS
if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 1090, __pyx_L1_error)
#endif
if (__pyx_t_5 >= __pyx_temp) break;
}
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
__pyx_t_10 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_5); __Pyx_INCREF(__pyx_t_10); __pyx_t_5++; if (unlikely((0 < 0))) __PYX_ERR(0, 1090, __pyx_L1_error)
#else
__pyx_t_10 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1090, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_10);
#endif
if (!(likely(PyDict_CheckExact(__pyx_t_10))||((__pyx_t_10) == Py_None) || __Pyx_RaiseUnexpectedTypeError("dict", __pyx_t_10))) __PYX_ERR(0, 1090, __pyx_L1_error)
__Pyx_XDECREF_SET(__pyx_v_sn, ((PyObject*)__pyx_t_10));
__pyx_t_10 = 0;
if (unlikely(__pyx_v_sn == Py_None)) {
PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "values");
__PYX_ERR(0, 1090, __pyx_L1_error)
}
__pyx_t_10 = __Pyx_PyDict_Values(__pyx_v_sn); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1090, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_10);
__pyx_t_14 = __Pyx_PyList_Extend(__pyx_v_found_matches, __pyx_t_10); if (unlikely(__pyx_t_14 == ((int)-1))) __PYX_ERR(0, 1090, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_t_1 = __pyx_v_sigindex_candidates; __Pyx_INCREF(__pyx_t_1);
__pyx_t_5 = 0;
for (;;) {
{
Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1);
#if !CYTHON_ASSUME_SAFE_MACROS
if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 1090, __pyx_L1_error)
#endif
if (__pyx_t_5 >= __pyx_temp) break;
}
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
__pyx_t_10 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_5); __Pyx_INCREF(__pyx_t_10); __pyx_t_5++; if (unlikely((0 < 0))) __PYX_ERR(0, 1090, __pyx_L1_error)
#else
__pyx_t_10 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1090, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_10);
#endif
if (!(likely(PyDict_CheckExact(__pyx_t_10))||((__pyx_t_10) == Py_None) || __Pyx_RaiseUnexpectedTypeError("dict", __pyx_t_10))) __PYX_ERR(0, 1090, __pyx_L1_error)
__Pyx_XDECREF_SET(__pyx_v_sn, ((PyObject*)__pyx_t_10));
__pyx_t_10 = 0;
if (unlikely(__pyx_v_sn == Py_None)) {
PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "values");
__PYX_ERR(0, 1090, __pyx_L1_error)
}
__pyx_t_10 = __Pyx_PyDict_Values(__pyx_v_sn); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1090, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_10);
__pyx_t_14 = __Pyx_PyList_Extend(__pyx_v_found_candidates, __pyx_t_10); if (unlikely(__pyx_t_14 == ((int)-1))) __PYX_ERR(0, 1090, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
goto __pyx_L25;
}
/*else*/ {
__pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1090, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__Pyx_INCREF(__pyx_v_sigindex_matches);
__Pyx_GIVEREF(__pyx_v_sigindex_matches);
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_sigindex_matches)) __PYX_ERR(0, 1090, __pyx_L1_error);
__Pyx_INCREF(__pyx_v_sigindex_candidates);
__Pyx_GIVEREF(__pyx_v_sigindex_candidates);
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_sigindex_candidates)) __PYX_ERR(0, 1090, __pyx_L1_error);
__pyx_t_10 = __pyx_t_1; __Pyx_INCREF(__pyx_t_10);
__pyx_t_5 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
for (;;) {
if (__pyx_t_5 >= 2) break;
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
__pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_10, __pyx_t_5); __Pyx_INCREF(__pyx_t_1); __pyx_t_5++; if (unlikely((0 < 0))) __PYX_ERR(0, 1090, __pyx_L1_error)
#else
__pyx_t_1 = __Pyx_PySequence_ITEM(__pyx_t_10, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1090, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
#endif
__Pyx_XDECREF_SET(__pyx_v_search_list, ((PyObject*)__pyx_t_1));
__pyx_t_1 = 0;
if (unlikely(__pyx_v_search_list == Py_None)) {
PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
__PYX_ERR(0, 1090, __pyx_L1_error)
}
__pyx_t_1 = __pyx_v_search_list; __Pyx_INCREF(__pyx_t_1);
__pyx_t_13 = 0;
for (;;) {
{
Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1);
#if !CYTHON_ASSUME_SAFE_MACROS
if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 1090, __pyx_L1_error)
#endif
if (__pyx_t_13 >= __pyx_temp) break;
}
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
__pyx_t_11 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_13); __Pyx_INCREF(__pyx_t_11); __pyx_t_13++; if (unlikely((0 < 0))) __PYX_ERR(0, 1090, __pyx_L1_error)
#else
__pyx_t_11 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1090, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_11);
#endif
if (!(likely(PyDict_CheckExact(__pyx_t_11))||((__pyx_t_11) == Py_None) || __Pyx_RaiseUnexpectedTypeError("dict", __pyx_t_11))) __PYX_ERR(0, 1090, __pyx_L1_error)
__Pyx_XDECREF_SET(__pyx_v_sn, ((PyObject*)__pyx_t_11));
__pyx_t_11 = 0;
if (unlikely(__pyx_v_sn == Py_None)) {
PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
__PYX_ERR(0, 1090, __pyx_L1_error)
}
__pyx_t_4 = (__Pyx_PyDict_ContainsTF(__pyx_v_dst_type, __pyx_v_sn, Py_EQ)); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 1090, __pyx_L1_error)
if (__pyx_t_4) {
if (unlikely(__pyx_v_sn == Py_None)) {
PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
__PYX_ERR(0, 1090, __pyx_L1_error)
}
__pyx_t_11 = __Pyx_PyDict_GetItem(__pyx_v_sn, __pyx_v_dst_type); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1090, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_11);
__pyx_t_14 = __Pyx_PyList_Append(__pyx_v_found_matches, __pyx_t_11); if (unlikely(__pyx_t_14 == ((int)-1))) __PYX_ERR(0, 1090, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
}
}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
}
__Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
}
__pyx_L25:;
__Pyx_INCREF(__pyx_v_found_matches);
__Pyx_DECREF_SET(__pyx_v_sigindex_matches, __pyx_v_found_matches);
__Pyx_INCREF(__pyx_v_found_candidates);
__Pyx_DECREF_SET(__pyx_v_sigindex_candidates, __pyx_v_found_candidates);
__pyx_t_2 = (PyList_GET_SIZE(__pyx_v_found_matches) != 0);
if (!__pyx_t_2) {
} else {
__pyx_t_4 = __pyx_t_2;
goto __pyx_L40_bool_binop_done;
}
__pyx_t_2 = (PyList_GET_SIZE(__pyx_v_found_candidates) != 0);
__pyx_t_4 = __pyx_t_2;
__pyx_L40_bool_binop_done:;
__pyx_t_2 = (!__pyx_t_4);
if (__pyx_t_2) {
goto __pyx_L24_break;
}
}
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
goto __pyx_L42_for_end;
__pyx_L24_break:;
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
goto __pyx_L42_for_end;
__pyx_L42_for_end:;
__Pyx_INCREF(__pyx_v_sigindex_matches);
__pyx_v_candidates = __pyx_v_sigindex_matches;
__pyx_t_2 = (PyList_GET_SIZE(__pyx_v_candidates) != 0);
__pyx_t_4 = (!__pyx_t_2);
if (unlikely(__pyx_t_4)) {
__pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__26, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1090, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_6);
__Pyx_Raise(__pyx_t_6, 0, 0, 0);
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
__PYX_ERR(0, 1090, __pyx_L1_error)
}
__pyx_t_7 = __Pyx_PyList_GET_SIZE(__pyx_v_candidates); if (unlikely(__pyx_t_7 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1090, __pyx_L1_error)
__pyx_t_4 = (__pyx_t_7 > 1);
if (unlikely(__pyx_t_4)) {
/* … */
__pyx_tuple__26 = PyTuple_Pack(1, __pyx_kp_s_No_matching_signature_found); if (unlikely(!__pyx_tuple__26)) __PYX_ERR(0, 1090, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__26);
__Pyx_GIVEREF(__pyx_tuple__26);
__pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__27, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1090, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_6);
__Pyx_Raise(__pyx_t_6, 0, 0, 0);
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
__PYX_ERR(0, 1090, __pyx_L1_error)
}
/*else*/ {
__Pyx_XDECREF(__pyx_r);
if (unlikely(__pyx_v_signatures == Py_None)) {
PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
__PYX_ERR(0, 1090, __pyx_L1_error)
}
__pyx_t_6 = __Pyx_GetItemInt_List(__pyx_v_candidates, 0, long, 1, __Pyx_PyInt_From_long, 1, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1090, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_6);
__pyx_t_10 = __Pyx_PyDict_GetItem(((PyObject*)__pyx_v_signatures), __pyx_t_6); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1090, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_10);
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
__pyx_r = __pyx_t_10;
__pyx_t_10 = 0;
goto __pyx_L0;
}
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_6);
__Pyx_XDECREF(__pyx_t_10);
__Pyx_XDECREF(__pyx_t_11);
__Pyx_XDECREF(__pyx_t_12);
__Pyx_AddTraceback("pysndlib.clm.__pyx_fused_cpdef", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XDECREF(__pyx_v_search_list);
__Pyx_XDECREF(__pyx_v_sn);
__Pyx_XDECREF(__pyx_v_sigindex_node);
__Pyx_XDECREF(__pyx_v_dest_sig);
__Pyx_XDECREF(__pyx_v_arg);
__Pyx_XDECREF(__pyx_v_sig);
__Pyx_XDECREF(__pyx_v_sig_series);
__Pyx_XDECREF(__pyx_v_last_type);
__Pyx_XDECREF(__pyx_v_sig_type);
__Pyx_XDECREF(__pyx_v_sigindex_matches);
__Pyx_XDECREF(__pyx_v_sigindex_candidates);
__Pyx_XDECREF(__pyx_v_dst_type);
__Pyx_XDECREF(__pyx_v_found_matches);
__Pyx_XDECREF(__pyx_v_found_candidates);
__Pyx_XDECREF(__pyx_v_candidates);
__Pyx_XDECREF(__pyx_v_kwargs);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pw_8pysndlib_3clm_614__pyx_fuse_0is_zero(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_8pysndlib_3clm_39is_zero(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_fuse_0__pyx_f_8pysndlib_3clm_is_zero(short __pyx_v_x, CYTHON_UNUSED int __pyx_skip_dispatch) {
int __pyx_r;
/* … */
/* function exit code */
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_614__pyx_fuse_0is_zero(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_fuse_0__pyx_mdef_8pysndlib_3clm_614__pyx_fuse_0is_zero = {"__pyx_fuse_0is_zero", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_8pysndlib_3clm_614__pyx_fuse_0is_zero, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_8pysndlib_3clm_614__pyx_fuse_0is_zero(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
short __pyx_v_x;
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__pyx_fuse_0is_zero (wrapper)", 0);
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,0};
PyObject* values[1] = {0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_VARARGS(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_x)) != 0)) {
(void)__Pyx_Arg_NewRef_VARARGS(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1090, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__pyx_fuse_0is_zero") < 0)) __PYX_ERR(0, 1090, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 1)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
}
__pyx_v_x = __Pyx_PyInt_As_short(values[0]); if (unlikely((__pyx_v_x == (short)-1) && PyErr_Occurred())) __PYX_ERR(0, 1090, __pyx_L3_error)
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("__pyx_fuse_0is_zero", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 1090, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.__pyx_fuse_0is_zero", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_8pysndlib_3clm_613__pyx_fuse_0is_zero(__pyx_self, __pyx_v_x);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_613__pyx_fuse_0is_zero(CYTHON_UNUSED PyObject *__pyx_self, short __pyx_v_x) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_fuse_0__pyx_f_8pysndlib_3clm_is_zero(__pyx_v_x, 0); if (unlikely(__pyx_t_1 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1090, __pyx_L1_error)
__pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1090, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("pysndlib.clm.__pyx_fuse_0is_zero", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pw_8pysndlib_3clm_616__pyx_fuse_1is_zero(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_8pysndlib_3clm_39is_zero(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_fuse_1__pyx_f_8pysndlib_3clm_is_zero(int __pyx_v_x, CYTHON_UNUSED int __pyx_skip_dispatch) {
int __pyx_r;
/* … */
/* function exit code */
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_616__pyx_fuse_1is_zero(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_fuse_1__pyx_mdef_8pysndlib_3clm_616__pyx_fuse_1is_zero = {"__pyx_fuse_1is_zero", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_8pysndlib_3clm_616__pyx_fuse_1is_zero, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_8pysndlib_3clm_616__pyx_fuse_1is_zero(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
int __pyx_v_x;
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__pyx_fuse_1is_zero (wrapper)", 0);
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,0};
PyObject* values[1] = {0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_VARARGS(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_x)) != 0)) {
(void)__Pyx_Arg_NewRef_VARARGS(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1090, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__pyx_fuse_1is_zero") < 0)) __PYX_ERR(0, 1090, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 1)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
}
__pyx_v_x = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_x == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1090, __pyx_L3_error)
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("__pyx_fuse_1is_zero", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 1090, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.__pyx_fuse_1is_zero", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_8pysndlib_3clm_615__pyx_fuse_1is_zero(__pyx_self, __pyx_v_x);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_615__pyx_fuse_1is_zero(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_x) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_fuse_1__pyx_f_8pysndlib_3clm_is_zero(__pyx_v_x, 0); if (unlikely(__pyx_t_1 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1090, __pyx_L1_error)
__pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1090, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("pysndlib.clm.__pyx_fuse_1is_zero", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pw_8pysndlib_3clm_618__pyx_fuse_2is_zero(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_8pysndlib_3clm_39is_zero(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_fuse_2__pyx_f_8pysndlib_3clm_is_zero(long __pyx_v_x, CYTHON_UNUSED int __pyx_skip_dispatch) {
int __pyx_r;
/* … */
/* function exit code */
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_618__pyx_fuse_2is_zero(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_fuse_2__pyx_mdef_8pysndlib_3clm_618__pyx_fuse_2is_zero = {"__pyx_fuse_2is_zero", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_8pysndlib_3clm_618__pyx_fuse_2is_zero, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_8pysndlib_3clm_618__pyx_fuse_2is_zero(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
long __pyx_v_x;
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__pyx_fuse_2is_zero (wrapper)", 0);
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,0};
PyObject* values[1] = {0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_VARARGS(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_x)) != 0)) {
(void)__Pyx_Arg_NewRef_VARARGS(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1090, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__pyx_fuse_2is_zero") < 0)) __PYX_ERR(0, 1090, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 1)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
}
__pyx_v_x = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_x == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 1090, __pyx_L3_error)
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("__pyx_fuse_2is_zero", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 1090, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.__pyx_fuse_2is_zero", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_8pysndlib_3clm_617__pyx_fuse_2is_zero(__pyx_self, __pyx_v_x);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_617__pyx_fuse_2is_zero(CYTHON_UNUSED PyObject *__pyx_self, long __pyx_v_x) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_fuse_2__pyx_f_8pysndlib_3clm_is_zero(__pyx_v_x, 0); if (unlikely(__pyx_t_1 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1090, __pyx_L1_error)
__pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1090, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("pysndlib.clm.__pyx_fuse_2is_zero", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pw_8pysndlib_3clm_620__pyx_fuse_3is_zero(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_8pysndlib_3clm_39is_zero(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_fuse_3__pyx_f_8pysndlib_3clm_is_zero(float __pyx_v_x, CYTHON_UNUSED int __pyx_skip_dispatch) {
int __pyx_r;
/* … */
/* function exit code */
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_620__pyx_fuse_3is_zero(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_fuse_3__pyx_mdef_8pysndlib_3clm_620__pyx_fuse_3is_zero = {"__pyx_fuse_3is_zero", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_8pysndlib_3clm_620__pyx_fuse_3is_zero, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_8pysndlib_3clm_620__pyx_fuse_3is_zero(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
float __pyx_v_x;
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__pyx_fuse_3is_zero (wrapper)", 0);
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,0};
PyObject* values[1] = {0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_VARARGS(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_x)) != 0)) {
(void)__Pyx_Arg_NewRef_VARARGS(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1090, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__pyx_fuse_3is_zero") < 0)) __PYX_ERR(0, 1090, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 1)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
}
__pyx_v_x = __pyx_PyFloat_AsFloat(values[0]); if (unlikely((__pyx_v_x == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 1090, __pyx_L3_error)
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("__pyx_fuse_3is_zero", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 1090, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.__pyx_fuse_3is_zero", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_8pysndlib_3clm_619__pyx_fuse_3is_zero(__pyx_self, __pyx_v_x);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_619__pyx_fuse_3is_zero(CYTHON_UNUSED PyObject *__pyx_self, float __pyx_v_x) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_fuse_3__pyx_f_8pysndlib_3clm_is_zero(__pyx_v_x, 0); if (unlikely(__pyx_t_1 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1090, __pyx_L1_error)
__pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1090, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("pysndlib.clm.__pyx_fuse_3is_zero", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pw_8pysndlib_3clm_622__pyx_fuse_4is_zero(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_8pysndlib_3clm_39is_zero(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_fuse_4__pyx_f_8pysndlib_3clm_is_zero(double __pyx_v_x, CYTHON_UNUSED int __pyx_skip_dispatch) {
int __pyx_r;
/* … */
/* function exit code */
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_622__pyx_fuse_4is_zero(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_fuse_4__pyx_mdef_8pysndlib_3clm_622__pyx_fuse_4is_zero = {"__pyx_fuse_4is_zero", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_8pysndlib_3clm_622__pyx_fuse_4is_zero, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_8pysndlib_3clm_622__pyx_fuse_4is_zero(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
double __pyx_v_x;
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__pyx_fuse_4is_zero (wrapper)", 0);
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,0};
PyObject* values[1] = {0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_VARARGS(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_x)) != 0)) {
(void)__Pyx_Arg_NewRef_VARARGS(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1090, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__pyx_fuse_4is_zero") < 0)) __PYX_ERR(0, 1090, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 1)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
}
__pyx_v_x = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_x == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1090, __pyx_L3_error)
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("__pyx_fuse_4is_zero", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 1090, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.__pyx_fuse_4is_zero", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_8pysndlib_3clm_621__pyx_fuse_4is_zero(__pyx_self, __pyx_v_x);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_621__pyx_fuse_4is_zero(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_x) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_fuse_4__pyx_f_8pysndlib_3clm_is_zero(__pyx_v_x, 0); if (unlikely(__pyx_t_1 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1090, __pyx_L1_error)
__pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1090, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("pysndlib.clm.__pyx_fuse_4is_zero", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pw_8pysndlib_3clm_624__pyx_fuse_5is_zero(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_8pysndlib_3clm_39is_zero(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_fuse_5__pyx_f_8pysndlib_3clm_is_zero(__pyx_t_float_complex __pyx_v_x, CYTHON_UNUSED int __pyx_skip_dispatch) {
int __pyx_r;
/* … */
/* function exit code */
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_624__pyx_fuse_5is_zero(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_fuse_5__pyx_mdef_8pysndlib_3clm_624__pyx_fuse_5is_zero = {"__pyx_fuse_5is_zero", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_8pysndlib_3clm_624__pyx_fuse_5is_zero, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_8pysndlib_3clm_624__pyx_fuse_5is_zero(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
__pyx_t_float_complex __pyx_v_x;
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__pyx_fuse_5is_zero (wrapper)", 0);
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,0};
PyObject* values[1] = {0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_VARARGS(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_x)) != 0)) {
(void)__Pyx_Arg_NewRef_VARARGS(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1090, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__pyx_fuse_5is_zero") < 0)) __PYX_ERR(0, 1090, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 1)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
}
__pyx_v_x = __Pyx_PyComplex_As___pyx_t_float_complex(values[0]); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1090, __pyx_L3_error)
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("__pyx_fuse_5is_zero", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 1090, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.__pyx_fuse_5is_zero", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_8pysndlib_3clm_623__pyx_fuse_5is_zero(__pyx_self, __pyx_v_x);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_623__pyx_fuse_5is_zero(CYTHON_UNUSED PyObject *__pyx_self, __pyx_t_float_complex __pyx_v_x) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_fuse_5__pyx_f_8pysndlib_3clm_is_zero(__pyx_v_x, 0); if (unlikely(__pyx_t_1 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1090, __pyx_L1_error)
__pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1090, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("pysndlib.clm.__pyx_fuse_5is_zero", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pw_8pysndlib_3clm_626__pyx_fuse_6is_zero(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_8pysndlib_3clm_39is_zero(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_fuse_6__pyx_f_8pysndlib_3clm_is_zero(__pyx_t_double_complex __pyx_v_x, CYTHON_UNUSED int __pyx_skip_dispatch) {
int __pyx_r;
/* … */
/* function exit code */
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_626__pyx_fuse_6is_zero(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_fuse_6__pyx_mdef_8pysndlib_3clm_626__pyx_fuse_6is_zero = {"__pyx_fuse_6is_zero", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_8pysndlib_3clm_626__pyx_fuse_6is_zero, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_8pysndlib_3clm_626__pyx_fuse_6is_zero(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
__pyx_t_double_complex __pyx_v_x;
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__pyx_fuse_6is_zero (wrapper)", 0);
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,0};
PyObject* values[1] = {0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_VARARGS(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_x)) != 0)) {
(void)__Pyx_Arg_NewRef_VARARGS(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1090, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__pyx_fuse_6is_zero") < 0)) __PYX_ERR(0, 1090, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 1)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
}
__pyx_v_x = __Pyx_PyComplex_As___pyx_t_double_complex(values[0]); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1090, __pyx_L3_error)
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("__pyx_fuse_6is_zero", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 1090, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.__pyx_fuse_6is_zero", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_8pysndlib_3clm_625__pyx_fuse_6is_zero(__pyx_self, __pyx_v_x);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_625__pyx_fuse_6is_zero(CYTHON_UNUSED PyObject *__pyx_self, __pyx_t_double_complex __pyx_v_x) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_fuse_6__pyx_f_8pysndlib_3clm_is_zero(__pyx_v_x, 0); if (unlikely(__pyx_t_1 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1090, __pyx_L1_error)
__pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1090, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("pysndlib.clm.__pyx_fuse_6is_zero", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
__pyx_tuple__27 = PyTuple_Pack(1, __pyx_kp_s_Function_call_with_ambiguous_arg); if (unlikely(!__pyx_tuple__27)) __PYX_ERR(0, 1090, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__27);
__Pyx_GIVEREF(__pyx_tuple__27);
/* … */
__pyx_codeobj__170 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__151, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_pyx_fuse_0is_zero, 1090, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__170)) __PYX_ERR(0, 1090, __pyx_L1_error)
/* … */
__pyx_t_43 = __Pyx_CyFunction_New(&__pyx_fuse_0__pyx_mdef_8pysndlib_3clm_614__pyx_fuse_0is_zero, 0, __pyx_n_s_pyx_fuse_0is_zero, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__171)); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 1090, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_is_zero, __pyx_t_43) < 0) __PYX_ERR(0, 1090, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
__pyx_codeobj__171 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__151, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_pyx_fuse_0is_zero, 1090, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__171)) __PYX_ERR(0, 1090, __pyx_L1_error)
__pyx_t_43 = __Pyx_CyFunction_New(&__pyx_fuse_1__pyx_mdef_8pysndlib_3clm_616__pyx_fuse_1is_zero, 0, __pyx_n_s_pyx_fuse_1is_zero, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__172)); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 1090, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_is_zero, __pyx_t_43) < 0) __PYX_ERR(0, 1090, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
__pyx_codeobj__172 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__151, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_pyx_fuse_1is_zero, 1090, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__172)) __PYX_ERR(0, 1090, __pyx_L1_error)
__pyx_t_43 = __Pyx_CyFunction_New(&__pyx_fuse_2__pyx_mdef_8pysndlib_3clm_618__pyx_fuse_2is_zero, 0, __pyx_n_s_pyx_fuse_2is_zero, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__173)); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 1090, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_is_zero, __pyx_t_43) < 0) __PYX_ERR(0, 1090, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
__pyx_codeobj__173 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__151, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_pyx_fuse_2is_zero, 1090, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__173)) __PYX_ERR(0, 1090, __pyx_L1_error)
__pyx_t_43 = __Pyx_CyFunction_New(&__pyx_fuse_3__pyx_mdef_8pysndlib_3clm_620__pyx_fuse_3is_zero, 0, __pyx_n_s_pyx_fuse_3is_zero, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__174)); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 1090, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_is_zero, __pyx_t_43) < 0) __PYX_ERR(0, 1090, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
__pyx_codeobj__174 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__151, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_pyx_fuse_3is_zero, 1090, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__174)) __PYX_ERR(0, 1090, __pyx_L1_error)
__pyx_t_43 = __Pyx_CyFunction_New(&__pyx_fuse_4__pyx_mdef_8pysndlib_3clm_622__pyx_fuse_4is_zero, 0, __pyx_n_s_pyx_fuse_4is_zero, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__175)); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 1090, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_is_zero, __pyx_t_43) < 0) __PYX_ERR(0, 1090, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
__pyx_codeobj__175 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__151, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_pyx_fuse_4is_zero, 1090, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__175)) __PYX_ERR(0, 1090, __pyx_L1_error)
__pyx_t_43 = __Pyx_CyFunction_New(&__pyx_fuse_5__pyx_mdef_8pysndlib_3clm_624__pyx_fuse_5is_zero, 0, __pyx_n_s_pyx_fuse_5is_zero, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__176)); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 1090, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_is_zero, __pyx_t_43) < 0) __PYX_ERR(0, 1090, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
__pyx_codeobj__176 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__151, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_pyx_fuse_5is_zero, 1090, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__176)) __PYX_ERR(0, 1090, __pyx_L1_error)
__pyx_t_43 = __Pyx_CyFunction_New(&__pyx_fuse_6__pyx_mdef_8pysndlib_3clm_626__pyx_fuse_6is_zero, 0, __pyx_n_s_pyx_fuse_6is_zero, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__177)); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 1090, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_is_zero, __pyx_t_43) < 0) __PYX_ERR(0, 1090, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
__pyx_t_43 = __Pyx_PyDict_NewPresized(7); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 1090, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
__pyx_t_40 = __pyx_FusedFunction_New(&__pyx_fuse_0__pyx_mdef_8pysndlib_3clm_614__pyx_fuse_0is_zero, 0, __pyx_n_s_pyx_fuse_0is_zero, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__170)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 1090, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
__Pyx_CyFunction_SetDefaultsTuple(__pyx_t_40, __pyx_empty_tuple);
if (PyDict_SetItem(__pyx_t_43, __pyx_n_s_short, __pyx_t_40) < 0) __PYX_ERR(0, 1090, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
__pyx_t_40 = __pyx_FusedFunction_New(&__pyx_fuse_1__pyx_mdef_8pysndlib_3clm_616__pyx_fuse_1is_zero, 0, __pyx_n_s_pyx_fuse_1is_zero, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__170)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 1090, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
__Pyx_CyFunction_SetDefaultsTuple(__pyx_t_40, __pyx_empty_tuple);
if (PyDict_SetItem(__pyx_t_43, __pyx_n_s_int_2, __pyx_t_40) < 0) __PYX_ERR(0, 1090, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
__pyx_t_40 = __pyx_FusedFunction_New(&__pyx_fuse_2__pyx_mdef_8pysndlib_3clm_618__pyx_fuse_2is_zero, 0, __pyx_n_s_pyx_fuse_2is_zero, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__170)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 1090, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
__Pyx_CyFunction_SetDefaultsTuple(__pyx_t_40, __pyx_empty_tuple);
if (PyDict_SetItem(__pyx_t_43, __pyx_n_s_long, __pyx_t_40) < 0) __PYX_ERR(0, 1090, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
__pyx_t_40 = __pyx_FusedFunction_New(&__pyx_fuse_3__pyx_mdef_8pysndlib_3clm_620__pyx_fuse_3is_zero, 0, __pyx_n_s_pyx_fuse_3is_zero, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__170)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 1090, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
__Pyx_CyFunction_SetDefaultsTuple(__pyx_t_40, __pyx_empty_tuple);
if (PyDict_SetItem(__pyx_t_43, __pyx_n_s_float, __pyx_t_40) < 0) __PYX_ERR(0, 1090, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
__pyx_t_40 = __pyx_FusedFunction_New(&__pyx_fuse_4__pyx_mdef_8pysndlib_3clm_622__pyx_fuse_4is_zero, 0, __pyx_n_s_pyx_fuse_4is_zero, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__170)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 1090, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
__Pyx_CyFunction_SetDefaultsTuple(__pyx_t_40, __pyx_empty_tuple);
if (PyDict_SetItem(__pyx_t_43, __pyx_n_s_double, __pyx_t_40) < 0) __PYX_ERR(0, 1090, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
__pyx_t_40 = __pyx_FusedFunction_New(&__pyx_fuse_5__pyx_mdef_8pysndlib_3clm_624__pyx_fuse_5is_zero, 0, __pyx_n_s_pyx_fuse_5is_zero, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__170)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 1090, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
__Pyx_CyFunction_SetDefaultsTuple(__pyx_t_40, __pyx_empty_tuple);
if (PyDict_SetItem(__pyx_t_43, __pyx_kp_s_float_complex, __pyx_t_40) < 0) __PYX_ERR(0, 1090, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
__pyx_t_40 = __pyx_FusedFunction_New(&__pyx_fuse_6__pyx_mdef_8pysndlib_3clm_626__pyx_fuse_6is_zero, 0, __pyx_n_s_pyx_fuse_6is_zero, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__170)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 1090, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
__Pyx_CyFunction_SetDefaultsTuple(__pyx_t_40, __pyx_empty_tuple);
if (PyDict_SetItem(__pyx_t_43, __pyx_kp_s_double_complex, __pyx_t_40) < 0) __PYX_ERR(0, 1090, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
__pyx_t_40 = __pyx_FusedFunction_New(&__pyx_mdef_8pysndlib_3clm_39is_zero, 0, __pyx_n_s_is_zero, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__170)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 1090, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
if (!__Pyx_CyFunction_InitDefaults(__pyx_t_40, sizeof(__pyx_defaults1), 1)) __PYX_ERR(0, 1090, __pyx_L1_error)
__pyx_t_37 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_37)) __PYX_ERR(0, 1090, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_37);
__Pyx_CyFunction_Defaults(__pyx_defaults1, __pyx_t_40)->__pyx_arg__fused_sigindex = __pyx_t_37;
__Pyx_GIVEREF(__pyx_t_37);
__pyx_t_37 = 0;
__Pyx_CyFunction_SetDefaultsTuple(__pyx_t_40, __pyx_empty_tuple);
((__pyx_FusedFunctionObject *) __pyx_t_40)->__signatures__ = __pyx_t_43;
__Pyx_GIVEREF(__pyx_t_43);
__pyx_t_43 = 0;
if (PyDict_SetItem(__pyx_d, __pyx_n_s_is_zero, __pyx_t_40) < 0) __PYX_ERR(0, 1090, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
__pyx_codeobj__177 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__151, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_pyx_fuse_6is_zero, 1090, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__177)) __PYX_ERR(0, 1090, __pyx_L1_error)
+1091: return x == 0
__pyx_r = (__pyx_v_x == 0); goto __pyx_L0; /* … */ __pyx_r = (__pyx_v_x == 0); goto __pyx_L0; /* … */ __pyx_r = (__pyx_v_x == 0); goto __pyx_L0; /* … */ __pyx_r = (__pyx_v_x == 0.0); goto __pyx_L0; /* … */ __pyx_r = (__pyx_v_x == 0.0); goto __pyx_L0; /* … */ __pyx_r = (__Pyx_c_eq_float(__pyx_v_x, __pyx_t_float_complex_from_parts(0, 0))); goto __pyx_L0; /* … */ __pyx_r = (__Pyx_c_eq_double(__pyx_v_x, __pyx_t_double_complex_from_parts(0, 0))); goto __pyx_L0;
1092:
+1093: cpdef bint is_number(n):
static PyObject *__pyx_pw_8pysndlib_3clm_41is_number(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static int __pyx_f_8pysndlib_3clm_is_number(PyObject *__pyx_v_n, CYTHON_UNUSED int __pyx_skip_dispatch) {
int __pyx_r;
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("pysndlib.clm.is_number", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = -1;
__pyx_L0:;
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_41is_number(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_8pysndlib_3clm_41is_number = {"is_number", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_41is_number, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_8pysndlib_3clm_41is_number(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
PyObject *__pyx_v_n = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("is_number (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_n,0};
PyObject* values[1] = {0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_n)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1093, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "is_number") < 0)) __PYX_ERR(0, 1093, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 1)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
}
__pyx_v_n = values[0];
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("is_number", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 1093, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.is_number", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_8pysndlib_3clm_40is_number(__pyx_self, __pyx_v_n);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_40is_number(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_n) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8pysndlib_3clm_is_number(__pyx_v_n, 0); if (unlikely(__pyx_t_1 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1093, __pyx_L1_error)
__pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1093, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("pysndlib.clm.is_number", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_tuple__178 = PyTuple_Pack(1, __pyx_n_s_n); if (unlikely(!__pyx_tuple__178)) __PYX_ERR(0, 1093, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__178);
__Pyx_GIVEREF(__pyx_tuple__178);
/* … */
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_41is_number, 0, __pyx_n_s_is_number, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__179)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 1093, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_is_number, __pyx_t_40) < 0) __PYX_ERR(0, 1093, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
__pyx_codeobj__179 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__178, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_is_number, 1093, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__179)) __PYX_ERR(0, 1093, __pyx_L1_error)
+1094: return type(n) == int or type(n) == float
__pyx_t_2 = PyObject_RichCompare(((PyObject *)Py_TYPE(__pyx_v_n)), ((PyObject *)(&PyInt_Type)), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1094, __pyx_L1_error) __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 1094, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (!__pyx_t_3) { } else { __pyx_t_1 = __pyx_t_3; goto __pyx_L3_bool_binop_done; } __pyx_t_2 = PyObject_RichCompare(((PyObject *)Py_TYPE(__pyx_v_n)), ((PyObject *)(&PyFloat_Type)), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1094, __pyx_L1_error) __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 1094, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_1 = __pyx_t_3; __pyx_L3_bool_binop_done:; __pyx_r = __pyx_t_1; goto __pyx_L0;
1095:
1096: # # --------------- clm utility functions ---------------- #
1097: #
+1098: cpdef cython.double radians2hz(cython.double radians ):
static PyObject *__pyx_pw_8pysndlib_3clm_43radians2hz(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static double __pyx_f_8pysndlib_3clm_radians2hz(double __pyx_v_radians, CYTHON_UNUSED int __pyx_skip_dispatch) {
double __pyx_r;
/* … */
/* function exit code */
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_43radians2hz(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_42radians2hz, "\n convert radians per sample to frequency: `hz = rads * srate / (2 * pi)`.\n \n :param radians: frequency \\in radians\n :return: frequency \\in hertz\n :rtype: float\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_43radians2hz = {"radians2hz", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_43radians2hz, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_42radians2hz};
static PyObject *__pyx_pw_8pysndlib_3clm_43radians2hz(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
double __pyx_v_radians;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("radians2hz (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_radians,0};
PyObject* values[1] = {0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_radians)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1098, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "radians2hz") < 0)) __PYX_ERR(0, 1098, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 1)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
}
__pyx_v_radians = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_radians == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1098, __pyx_L3_error)
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("radians2hz", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 1098, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.radians2hz", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_8pysndlib_3clm_42radians2hz(__pyx_self, __pyx_v_radians);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_42radians2hz(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_radians) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8pysndlib_3clm_radians2hz(__pyx_v_radians, 0); if (unlikely(__pyx_t_1 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1098, __pyx_L1_error)
__pyx_t_2 = PyFloat_FromDouble(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1098, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("pysndlib.clm.radians2hz", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_tuple__180 = PyTuple_Pack(1, __pyx_n_s_radians); if (unlikely(!__pyx_tuple__180)) __PYX_ERR(0, 1098, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__180);
__Pyx_GIVEREF(__pyx_tuple__180);
/* … */
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_43radians2hz, 0, __pyx_n_s_radians2hz, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__181)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 1098, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_radians2hz, __pyx_t_40) < 0) __PYX_ERR(0, 1098, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
__pyx_codeobj__181 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__180, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_radians2hz, 1098, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__181)) __PYX_ERR(0, 1098, __pyx_L1_error)
1099: """
1100: convert radians per sample to frequency: `hz = rads * srate / (2 * pi)`.
1101:
1102: :param radians: frequency \in radians
1103: :return: frequency \in hertz
1104: :rtype: float
1105: """
+1106: return cclm.mus_radians_to_hz(radians)
__pyx_r = mus_radians_to_hz(__pyx_v_radians); goto __pyx_L0;
1107:
+1108: cpdef cython.double hz2radians(cython.double hz):
static PyObject *__pyx_pw_8pysndlib_3clm_45hz2radians(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static double __pyx_f_8pysndlib_3clm_hz2radians(double __pyx_v_hz, CYTHON_UNUSED int __pyx_skip_dispatch) {
double __pyx_r;
/* … */
/* function exit code */
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_45hz2radians(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_44hz2radians, "\n convert frequency in hz to radians per sample: `hz * 2 * pi / srate`.\n \n :param hz: frequency \\in hertz\n :return: frequency \\in radians\n :rtype: float\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_45hz2radians = {"hz2radians", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_45hz2radians, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_44hz2radians};
static PyObject *__pyx_pw_8pysndlib_3clm_45hz2radians(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
double __pyx_v_hz;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("hz2radians (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_hz,0};
PyObject* values[1] = {0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_hz)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1108, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "hz2radians") < 0)) __PYX_ERR(0, 1108, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 1)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
}
__pyx_v_hz = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_hz == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1108, __pyx_L3_error)
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("hz2radians", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 1108, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.hz2radians", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_8pysndlib_3clm_44hz2radians(__pyx_self, __pyx_v_hz);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_44hz2radians(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_hz) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8pysndlib_3clm_hz2radians(__pyx_v_hz, 0); if (unlikely(__pyx_t_1 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1108, __pyx_L1_error)
__pyx_t_2 = PyFloat_FromDouble(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1108, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("pysndlib.clm.hz2radians", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_tuple__182 = PyTuple_Pack(1, __pyx_n_s_hz); if (unlikely(!__pyx_tuple__182)) __PYX_ERR(0, 1108, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__182);
__Pyx_GIVEREF(__pyx_tuple__182);
/* … */
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_45hz2radians, 0, __pyx_n_s_hz2radians, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__183)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 1108, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_hz2radians, __pyx_t_40) < 0) __PYX_ERR(0, 1108, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
__pyx_codeobj__183 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__182, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_hz2radians, 1108, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__183)) __PYX_ERR(0, 1108, __pyx_L1_error)
1109: """
1110: convert frequency in hz to radians per sample: `hz * 2 * pi / srate`.
1111:
1112: :param hz: frequency \in hertz
1113: :return: frequency \in radians
1114: :rtype: float
1115: """
+1116: return cclm.mus_hz_to_radians(hz)
__pyx_r = mus_hz_to_radians(__pyx_v_hz); goto __pyx_L0;
1117:
+1118: cpdef cython.double degrees2radians(cython.double degrees):
static PyObject *__pyx_pw_8pysndlib_3clm_47degrees2radians(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static double __pyx_f_8pysndlib_3clm_degrees2radians(double __pyx_v_degrees, CYTHON_UNUSED int __pyx_skip_dispatch) {
double __pyx_r;
/* … */
/* function exit code */
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_47degrees2radians(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_46degrees2radians, "\n convert degrees to radians: `degrees * 2 * pi / 360`.\n \n :param degrees: angle in degrees\n :return: angle in radians\n :rtype: float\n \n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_47degrees2radians = {"degrees2radians", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_47degrees2radians, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_46degrees2radians};
static PyObject *__pyx_pw_8pysndlib_3clm_47degrees2radians(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
double __pyx_v_degrees;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("degrees2radians (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_degrees,0};
PyObject* values[1] = {0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_degrees)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1118, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "degrees2radians") < 0)) __PYX_ERR(0, 1118, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 1)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
}
__pyx_v_degrees = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_degrees == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1118, __pyx_L3_error)
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("degrees2radians", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 1118, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.degrees2radians", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_8pysndlib_3clm_46degrees2radians(__pyx_self, __pyx_v_degrees);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_46degrees2radians(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_degrees) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8pysndlib_3clm_degrees2radians(__pyx_v_degrees, 0); if (unlikely(__pyx_t_1 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1118, __pyx_L1_error)
__pyx_t_2 = PyFloat_FromDouble(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1118, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("pysndlib.clm.degrees2radians", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_tuple__184 = PyTuple_Pack(1, __pyx_n_s_degrees); if (unlikely(!__pyx_tuple__184)) __PYX_ERR(0, 1118, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__184);
__Pyx_GIVEREF(__pyx_tuple__184);
/* … */
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_47degrees2radians, 0, __pyx_n_s_degrees2radians, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__185)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 1118, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_degrees2radians, __pyx_t_40) < 0) __PYX_ERR(0, 1118, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
__pyx_codeobj__185 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__184, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_degrees2radians, 1118, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__185)) __PYX_ERR(0, 1118, __pyx_L1_error)
1119: """
1120: convert degrees to radians: `degrees * 2 * pi / 360`.
1121:
1122: :param degrees: angle in degrees
1123: :return: angle in radians
1124: :rtype: float
1125:
1126: """
+1127: return cclm.mus_degrees_to_radians(degrees)
__pyx_r = mus_degrees_to_radians(__pyx_v_degrees); goto __pyx_L0;
1128:
+1129: cpdef cython.double radians2degrees(cython.double radians):
static PyObject *__pyx_pw_8pysndlib_3clm_49radians2degrees(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static double __pyx_f_8pysndlib_3clm_radians2degrees(double __pyx_v_radians, CYTHON_UNUSED int __pyx_skip_dispatch) {
double __pyx_r;
/* … */
/* function exit code */
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_49radians2degrees(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_48radians2degrees, "\n convert radians to degrees: `rads * 360 / (2 * pi)`.\n \n :param radians: angle in radians\n :return: degree\n :rtype: float\n \n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_49radians2degrees = {"radians2degrees", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_49radians2degrees, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_48radians2degrees};
static PyObject *__pyx_pw_8pysndlib_3clm_49radians2degrees(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
double __pyx_v_radians;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("radians2degrees (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_radians,0};
PyObject* values[1] = {0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_radians)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1129, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "radians2degrees") < 0)) __PYX_ERR(0, 1129, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 1)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
}
__pyx_v_radians = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_radians == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1129, __pyx_L3_error)
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("radians2degrees", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 1129, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.radians2degrees", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_8pysndlib_3clm_48radians2degrees(__pyx_self, __pyx_v_radians);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_48radians2degrees(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_radians) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8pysndlib_3clm_radians2degrees(__pyx_v_radians, 0); if (unlikely(__pyx_t_1 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1129, __pyx_L1_error)
__pyx_t_2 = PyFloat_FromDouble(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1129, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("pysndlib.clm.radians2degrees", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_49radians2degrees, 0, __pyx_n_s_radians2degrees, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__186)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 1129, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_radians2degrees, __pyx_t_40) < 0) __PYX_ERR(0, 1129, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
/* … */
__pyx_codeobj__186 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__180, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_radians2degrees, 1129, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__186)) __PYX_ERR(0, 1129, __pyx_L1_error)
1130: """
1131: convert radians to degrees: `rads * 360 / (2 * pi)`.
1132:
1133: :param radians: angle in radians
1134: :return: degree
1135: :rtype: float
1136:
1137: """
1138:
+1139: return cclm.mus_radians_to_degrees(radians)
__pyx_r = mus_radians_to_degrees(__pyx_v_radians); goto __pyx_L0;
1140:
+1141: cpdef cython.double db2linear(cython.double x):
static PyObject *__pyx_pw_8pysndlib_3clm_51db2linear(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static double __pyx_f_8pysndlib_3clm_db2linear(double __pyx_v_x, CYTHON_UNUSED int __pyx_skip_dispatch) {
double __pyx_r;
/* … */
/* function exit code */
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_51db2linear(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_50db2linear, "\n convert decibel value db to linear value: `pow(10, db / 20)`.\n\n :param x: decibel\n :return: linear amplitude\n :rtype: float\n \n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_51db2linear = {"db2linear", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_51db2linear, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_50db2linear};
static PyObject *__pyx_pw_8pysndlib_3clm_51db2linear(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
double __pyx_v_x;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("db2linear (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,0};
PyObject* values[1] = {0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_x)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1141, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "db2linear") < 0)) __PYX_ERR(0, 1141, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 1)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
}
__pyx_v_x = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_x == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1141, __pyx_L3_error)
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("db2linear", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 1141, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.db2linear", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_8pysndlib_3clm_50db2linear(__pyx_self, __pyx_v_x);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_50db2linear(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_x) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8pysndlib_3clm_db2linear(__pyx_v_x, 0); if (unlikely(__pyx_t_1 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1141, __pyx_L1_error)
__pyx_t_2 = PyFloat_FromDouble(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1141, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("pysndlib.clm.db2linear", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_51db2linear, 0, __pyx_n_s_db2linear, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__187)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 1141, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_db2linear, __pyx_t_40) < 0) __PYX_ERR(0, 1141, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
/* … */
__pyx_codeobj__187 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__151, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_db2linear, 1141, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__187)) __PYX_ERR(0, 1141, __pyx_L1_error)
1142: """
1143: convert decibel value db to linear value: `pow(10, db / 20)`.
1144:
1145: :param x: decibel
1146: :return: linear amplitude
1147: :rtype: float
1148:
1149: """
1150:
+1151: return cclm.mus_db_to_linear(x)
__pyx_r = mus_db_to_linear(__pyx_v_x); goto __pyx_L0;
1152:
+1153: cpdef cython.double linear2db(cython.double x):
static PyObject *__pyx_pw_8pysndlib_3clm_53linear2db(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static double __pyx_f_8pysndlib_3clm_linear2db(double __pyx_v_x, CYTHON_UNUSED int __pyx_skip_dispatch) {
double __pyx_r;
/* … */
/* function exit code */
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_53linear2db(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_52linear2db, "\n convert linear value to decibels 20 * log10(lin).\n\n :param x: linear amplitude\n :return: decibel\n :rtype: float\n \n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_53linear2db = {"linear2db", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_53linear2db, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_52linear2db};
static PyObject *__pyx_pw_8pysndlib_3clm_53linear2db(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
double __pyx_v_x;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("linear2db (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,0};
PyObject* values[1] = {0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_x)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1153, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "linear2db") < 0)) __PYX_ERR(0, 1153, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 1)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
}
__pyx_v_x = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_x == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1153, __pyx_L3_error)
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("linear2db", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 1153, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.linear2db", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_8pysndlib_3clm_52linear2db(__pyx_self, __pyx_v_x);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_52linear2db(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_x) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8pysndlib_3clm_linear2db(__pyx_v_x, 0); if (unlikely(__pyx_t_1 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1153, __pyx_L1_error)
__pyx_t_2 = PyFloat_FromDouble(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1153, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("pysndlib.clm.linear2db", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_53linear2db, 0, __pyx_n_s_linear2db, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__188)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 1153, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_linear2db, __pyx_t_40) < 0) __PYX_ERR(0, 1153, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
/* … */
__pyx_codeobj__188 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__151, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_linear2db, 1153, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__188)) __PYX_ERR(0, 1153, __pyx_L1_error)
1154: """
1155: convert linear value to decibels 20 * log10(lin).
1156:
1157: :param x: linear amplitude
1158: :return: decibel
1159: :rtype: float
1160:
1161: """
1162:
+1163: return cclm.mus_linear_to_db(x)
__pyx_r = mus_linear_to_db(__pyx_v_x); goto __pyx_L0;
1164:
+1165: cpdef cython.double odd_multiple(cython.double x, cython.double y):
static PyObject *__pyx_pw_8pysndlib_3clm_55odd_multiple(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static double __pyx_f_8pysndlib_3clm_odd_multiple(double __pyx_v_x, double __pyx_v_y, CYTHON_UNUSED int __pyx_skip_dispatch) {
double __pyx_r;
/* … */
/* function exit code */
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_55odd_multiple(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_54odd_multiple, "\n return y times the nearest odd integer to x.\n \n :param x:\n :param y:\n :return: nearest odd integer as a float\n :rtype: float\n \n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_55odd_multiple = {"odd_multiple", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_55odd_multiple, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_54odd_multiple};
static PyObject *__pyx_pw_8pysndlib_3clm_55odd_multiple(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
double __pyx_v_x;
double __pyx_v_y;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("odd_multiple (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_y,0};
PyObject* values[2] = {0,0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_x)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1165, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_y)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1165, __pyx_L3_error)
else {
__Pyx_RaiseArgtupleInvalid("odd_multiple", 1, 2, 2, 1); __PYX_ERR(0, 1165, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "odd_multiple") < 0)) __PYX_ERR(0, 1165, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 2)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
}
__pyx_v_x = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_x == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1165, __pyx_L3_error)
__pyx_v_y = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_y == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1165, __pyx_L3_error)
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("odd_multiple", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 1165, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.odd_multiple", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_8pysndlib_3clm_54odd_multiple(__pyx_self, __pyx_v_x, __pyx_v_y);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_54odd_multiple(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_x, double __pyx_v_y) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8pysndlib_3clm_odd_multiple(__pyx_v_x, __pyx_v_y, 0); if (unlikely(__pyx_t_1 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1165, __pyx_L1_error)
__pyx_t_2 = PyFloat_FromDouble(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1165, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("pysndlib.clm.odd_multiple", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_tuple__189 = PyTuple_Pack(2, __pyx_n_s_x, __pyx_n_s_y); if (unlikely(!__pyx_tuple__189)) __PYX_ERR(0, 1165, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__189);
__Pyx_GIVEREF(__pyx_tuple__189);
/* … */
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_55odd_multiple, 0, __pyx_n_s_odd_multiple, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__190)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 1165, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_odd_multiple, __pyx_t_40) < 0) __PYX_ERR(0, 1165, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
__pyx_codeobj__190 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__189, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_odd_multiple, 1165, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__190)) __PYX_ERR(0, 1165, __pyx_L1_error)
1166: """
1167: return y times the nearest odd integer to x.
1168:
1169: :param x:
1170: :param y:
1171: :return: nearest odd integer as a float
1172: :rtype: float
1173:
1174: """
1175:
+1176: return cclm.mus_odd_multiple(x,y)
__pyx_r = mus_odd_multiple(__pyx_v_x, __pyx_v_y); goto __pyx_L0;
1177:
+1178: cpdef cython.double even_multiple(cython.double x, cython.double y):
static PyObject *__pyx_pw_8pysndlib_3clm_57even_multiple(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static double __pyx_f_8pysndlib_3clm_even_multiple(double __pyx_v_x, double __pyx_v_y, CYTHON_UNUSED int __pyx_skip_dispatch) {
double __pyx_r;
/* … */
/* function exit code */
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_57even_multiple(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_56even_multiple, "\n return y times the nearest even integer to x.\n \n :param x:\n :param y:\n :return: nearest even integer as a float\n :rtype: float\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_57even_multiple = {"even_multiple", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_57even_multiple, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_56even_multiple};
static PyObject *__pyx_pw_8pysndlib_3clm_57even_multiple(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
double __pyx_v_x;
double __pyx_v_y;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("even_multiple (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_y,0};
PyObject* values[2] = {0,0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_x)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1178, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_y)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1178, __pyx_L3_error)
else {
__Pyx_RaiseArgtupleInvalid("even_multiple", 1, 2, 2, 1); __PYX_ERR(0, 1178, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "even_multiple") < 0)) __PYX_ERR(0, 1178, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 2)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
}
__pyx_v_x = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_x == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1178, __pyx_L3_error)
__pyx_v_y = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_y == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1178, __pyx_L3_error)
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("even_multiple", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 1178, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.even_multiple", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_8pysndlib_3clm_56even_multiple(__pyx_self, __pyx_v_x, __pyx_v_y);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_56even_multiple(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_x, double __pyx_v_y) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8pysndlib_3clm_even_multiple(__pyx_v_x, __pyx_v_y, 0); if (unlikely(__pyx_t_1 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1178, __pyx_L1_error)
__pyx_t_2 = PyFloat_FromDouble(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1178, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("pysndlib.clm.even_multiple", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_57even_multiple, 0, __pyx_n_s_even_multiple, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__191)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 1178, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_even_multiple, __pyx_t_40) < 0) __PYX_ERR(0, 1178, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
/* … */
__pyx_codeobj__191 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__189, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_even_multiple, 1178, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__191)) __PYX_ERR(0, 1178, __pyx_L1_error)
1179: """
1180: return y times the nearest even integer to x.
1181:
1182: :param x:
1183: :param y:
1184: :return: nearest even integer as a float
1185: :rtype: float
1186: """
1187:
+1188: return cclm.mus_even_multiple(x,y)
__pyx_r = mus_even_multiple(__pyx_v_x, __pyx_v_y); goto __pyx_L0;
1189:
+1190: cpdef cython.double odd_weight(cython.double x):
static PyObject *__pyx_pw_8pysndlib_3clm_59odd_weight(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static double __pyx_f_8pysndlib_3clm_odd_weight(double __pyx_v_x, CYTHON_UNUSED int __pyx_skip_dispatch) {
double __pyx_r;
/* … */
/* function exit code */
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_59odd_weight(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_58odd_weight, "\n return a number between 0.0 (x is even) and 1.0 (x is odd).\n \n :param x:\n :return weight:\n :rtype: float\n \n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_59odd_weight = {"odd_weight", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_59odd_weight, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_58odd_weight};
static PyObject *__pyx_pw_8pysndlib_3clm_59odd_weight(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
double __pyx_v_x;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("odd_weight (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,0};
PyObject* values[1] = {0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_x)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1190, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "odd_weight") < 0)) __PYX_ERR(0, 1190, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 1)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
}
__pyx_v_x = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_x == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1190, __pyx_L3_error)
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("odd_weight", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 1190, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.odd_weight", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_8pysndlib_3clm_58odd_weight(__pyx_self, __pyx_v_x);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_58odd_weight(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_x) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8pysndlib_3clm_odd_weight(__pyx_v_x, 0); if (unlikely(__pyx_t_1 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1190, __pyx_L1_error)
__pyx_t_2 = PyFloat_FromDouble(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1190, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("pysndlib.clm.odd_weight", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_59odd_weight, 0, __pyx_n_s_odd_weight, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__192)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 1190, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_odd_weight, __pyx_t_40) < 0) __PYX_ERR(0, 1190, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
/* … */
__pyx_codeobj__192 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__151, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_odd_weight, 1190, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__192)) __PYX_ERR(0, 1190, __pyx_L1_error)
1191: """
1192: return a number between 0.0 (x is even) and 1.0 (x is odd).
1193:
1194: :param x:
1195: :return weight:
1196: :rtype: float
1197:
1198: """
1199:
+1200: return cclm.mus_odd_weight(x)
__pyx_r = mus_odd_weight(__pyx_v_x); goto __pyx_L0;
1201:
+1202: cpdef cython.double even_weight(cython.double x):
static PyObject *__pyx_pw_8pysndlib_3clm_61even_weight(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static double __pyx_f_8pysndlib_3clm_even_weight(double __pyx_v_x, CYTHON_UNUSED int __pyx_skip_dispatch) {
double __pyx_r;
/* … */
/* function exit code */
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_61even_weight(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_60even_weight, "\n return a number between 0.0 (x is odd) and 1.0 (x is even).\n \n :param x:\n :return weight:\n :rtype: float\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_61even_weight = {"even_weight", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_61even_weight, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_60even_weight};
static PyObject *__pyx_pw_8pysndlib_3clm_61even_weight(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
double __pyx_v_x;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("even_weight (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,0};
PyObject* values[1] = {0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_x)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1202, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "even_weight") < 0)) __PYX_ERR(0, 1202, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 1)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
}
__pyx_v_x = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_x == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1202, __pyx_L3_error)
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("even_weight", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 1202, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.even_weight", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_8pysndlib_3clm_60even_weight(__pyx_self, __pyx_v_x);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_60even_weight(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_x) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8pysndlib_3clm_even_weight(__pyx_v_x, 0); if (unlikely(__pyx_t_1 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1202, __pyx_L1_error)
__pyx_t_2 = PyFloat_FromDouble(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1202, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("pysndlib.clm.even_weight", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_61even_weight, 0, __pyx_n_s_even_weight, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__193)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 1202, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_even_weight, __pyx_t_40) < 0) __PYX_ERR(0, 1202, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
/* … */
__pyx_codeobj__193 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__151, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_even_weight, 1202, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__193)) __PYX_ERR(0, 1202, __pyx_L1_error)
1203: """
1204: return a number between 0.0 (x is odd) and 1.0 (x is even).
1205:
1206: :param x:
1207: :return weight:
1208: :rtype: float
1209: """
1210:
+1211: return cclm.mus_even_weight(x)
__pyx_r = mus_even_weight(__pyx_v_x); goto __pyx_L0;
1212:
+1213: cpdef cython.double get_srate():
static PyObject *__pyx_pw_8pysndlib_3clm_63get_srate(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static double __pyx_f_8pysndlib_3clm_get_srate(CYTHON_UNUSED int __pyx_skip_dispatch) {
double __pyx_r;
/* … */
/* function exit code */
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_63get_srate(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_62get_srate, "\n return current sample rate.\n \n :return samplerate:\n :rtype: float\n \n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_63get_srate = {"get_srate", (PyCFunction)__pyx_pw_8pysndlib_3clm_63get_srate, METH_NOARGS, __pyx_doc_8pysndlib_3clm_62get_srate};
static PyObject *__pyx_pw_8pysndlib_3clm_63get_srate(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("get_srate (wrapper)", 0);
__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
__pyx_r = __pyx_pf_8pysndlib_3clm_62get_srate(__pyx_self);
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_62get_srate(CYTHON_UNUSED PyObject *__pyx_self) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8pysndlib_3clm_get_srate(0); if (unlikely(__pyx_t_1 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1213, __pyx_L1_error)
__pyx_t_2 = PyFloat_FromDouble(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1213, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("pysndlib.clm.get_srate", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_63get_srate, 0, __pyx_n_s_get_srate, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__194)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 1213, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_get_srate, __pyx_t_40) < 0) __PYX_ERR(0, 1213, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
/* … */
__pyx_codeobj__194 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_get_srate, 1213, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__194)) __PYX_ERR(0, 1213, __pyx_L1_error)
1214: """
1215: return current sample rate.
1216:
1217: :return samplerate:
1218: :rtype: float
1219:
1220: """
+1221: return cclm.mus_srate()
__pyx_r = mus_srate(); goto __pyx_L0;
1222:
+1223: cpdef cython.double set_srate(cython.double r):
static PyObject *__pyx_pw_8pysndlib_3clm_65set_srate(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static double __pyx_f_8pysndlib_3clm_set_srate(double __pyx_v_r, CYTHON_UNUSED int __pyx_skip_dispatch) {
double __pyx_r;
/* … */
/* function exit code */
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_65set_srate(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_64set_srate, "\n set current sample rate.\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_65set_srate = {"set_srate", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_65set_srate, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_64set_srate};
static PyObject *__pyx_pw_8pysndlib_3clm_65set_srate(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
double __pyx_v_r;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("set_srate (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_r,0};
PyObject* values[1] = {0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_r)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1223, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "set_srate") < 0)) __PYX_ERR(0, 1223, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 1)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
}
__pyx_v_r = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_r == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1223, __pyx_L3_error)
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("set_srate", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 1223, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.set_srate", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_8pysndlib_3clm_64set_srate(__pyx_self, __pyx_v_r);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_64set_srate(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_r) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8pysndlib_3clm_set_srate(__pyx_v_r, 0); if (unlikely(__pyx_t_1 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1223, __pyx_L1_error)
__pyx_t_2 = PyFloat_FromDouble(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1223, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("pysndlib.clm.set_srate", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_tuple__195 = PyTuple_Pack(1, __pyx_n_s_r); if (unlikely(!__pyx_tuple__195)) __PYX_ERR(0, 1223, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__195);
__Pyx_GIVEREF(__pyx_tuple__195);
/* … */
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_65set_srate, 0, __pyx_n_s_set_srate, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__196)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 1223, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_set_srate, __pyx_t_40) < 0) __PYX_ERR(0, 1223, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
__pyx_codeobj__196 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__195, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_set_srate, 1223, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__196)) __PYX_ERR(0, 1223, __pyx_L1_error)
1224: """
1225: set current sample rate.
1226: """
+1227: return cclm.mus_set_srate(r)
__pyx_r = mus_set_srate(__pyx_v_r); goto __pyx_L0;
1228:
+1229: cpdef cython.long seconds2samples(cython.double secs):
static PyObject *__pyx_pw_8pysndlib_3clm_67seconds2samples(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static long __pyx_f_8pysndlib_3clm_seconds2samples(double __pyx_v_secs, CYTHON_UNUSED int __pyx_skip_dispatch) {
long __pyx_r;
/* … */
/* function exit code */
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_67seconds2samples(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_66seconds2samples, "\n use mus_srate to convert seconds to samples.\n \n :param secs: time in seconds\n :return: time in samples\n :rtype: int\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_67seconds2samples = {"seconds2samples", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_67seconds2samples, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_66seconds2samples};
static PyObject *__pyx_pw_8pysndlib_3clm_67seconds2samples(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
double __pyx_v_secs;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("seconds2samples (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_secs,0};
PyObject* values[1] = {0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_secs)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1229, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "seconds2samples") < 0)) __PYX_ERR(0, 1229, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 1)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
}
__pyx_v_secs = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_secs == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1229, __pyx_L3_error)
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("seconds2samples", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 1229, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.seconds2samples", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_8pysndlib_3clm_66seconds2samples(__pyx_self, __pyx_v_secs);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_66seconds2samples(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_secs) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8pysndlib_3clm_seconds2samples(__pyx_v_secs, 0); if (unlikely(__pyx_t_1 == ((long)-1) && PyErr_Occurred())) __PYX_ERR(0, 1229, __pyx_L1_error)
__pyx_t_2 = __Pyx_PyInt_From_long(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1229, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("pysndlib.clm.seconds2samples", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_tuple__197 = PyTuple_Pack(1, __pyx_n_s_secs); if (unlikely(!__pyx_tuple__197)) __PYX_ERR(0, 1229, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__197);
__Pyx_GIVEREF(__pyx_tuple__197);
/* … */
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_67seconds2samples, 0, __pyx_n_s_seconds2samples, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__198)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 1229, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_seconds2samples, __pyx_t_40) < 0) __PYX_ERR(0, 1229, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
__pyx_codeobj__198 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__197, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_seconds2samples, 1229, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__198)) __PYX_ERR(0, 1229, __pyx_L1_error)
1230: """
1231: use mus_srate to convert seconds to samples.
1232:
1233: :param secs: time in seconds
1234: :return: time in samples
1235: :rtype: int
1236: """
+1237: return cclm.mus_seconds_to_samples(secs)
__pyx_r = mus_seconds_to_samples(__pyx_v_secs); goto __pyx_L0;
1238:
+1239: cpdef cython.double samples2seconds(cython.long samples):
static PyObject *__pyx_pw_8pysndlib_3clm_69samples2seconds(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static double __pyx_f_8pysndlib_3clm_samples2seconds(long __pyx_v_samples, CYTHON_UNUSED int __pyx_skip_dispatch) {
double __pyx_r;
/* … */
/* function exit code */
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_69samples2seconds(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_68samples2seconds, "\n use mus_srate to convert samples to seconds.\n \n :param samples: number of samples\n :return: time in seconds\n :rtype: float\n \n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_69samples2seconds = {"samples2seconds", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_69samples2seconds, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_68samples2seconds};
static PyObject *__pyx_pw_8pysndlib_3clm_69samples2seconds(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
long __pyx_v_samples;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("samples2seconds (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_samples,0};
PyObject* values[1] = {0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_samples)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1239, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "samples2seconds") < 0)) __PYX_ERR(0, 1239, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 1)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
}
__pyx_v_samples = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_samples == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 1239, __pyx_L3_error)
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("samples2seconds", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 1239, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.samples2seconds", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_8pysndlib_3clm_68samples2seconds(__pyx_self, __pyx_v_samples);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_68samples2seconds(CYTHON_UNUSED PyObject *__pyx_self, long __pyx_v_samples) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8pysndlib_3clm_samples2seconds(__pyx_v_samples, 0); if (unlikely(__pyx_t_1 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1239, __pyx_L1_error)
__pyx_t_2 = PyFloat_FromDouble(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1239, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("pysndlib.clm.samples2seconds", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_tuple__199 = PyTuple_Pack(1, __pyx_n_s_samples); if (unlikely(!__pyx_tuple__199)) __PYX_ERR(0, 1239, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__199);
__Pyx_GIVEREF(__pyx_tuple__199);
/* … */
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_69samples2seconds, 0, __pyx_n_s_samples2seconds, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__200)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 1239, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_samples2seconds, __pyx_t_40) < 0) __PYX_ERR(0, 1239, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
__pyx_codeobj__200 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__199, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_samples2seconds, 1239, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__200)) __PYX_ERR(0, 1239, __pyx_L1_error)
1240: """
1241: use mus_srate to convert samples to seconds.
1242:
1243: :param samples: number of samples
1244: :return: time in seconds
1245: :rtype: float
1246:
1247: """
+1248: return cclm.mus_samples_to_seconds(samples)
__pyx_r = mus_samples_to_seconds(__pyx_v_samples); goto __pyx_L0;
1249:
+1250: cpdef cython.double ring_modulate(cython.double s1, cython.double s2):
static PyObject *__pyx_pw_8pysndlib_3clm_71ring_modulate(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static double __pyx_f_8pysndlib_3clm_ring_modulate(double __pyx_v_s1, double __pyx_v_s2, CYTHON_UNUSED int __pyx_skip_dispatch) {
double __pyx_r;
/* … */
/* function exit code */
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_71ring_modulate(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_70ring_modulate, "\n return s1 * s2 (sample by sample multiply).\n \n :param s1: input 1\n :param s2: input 2\n :return: result\n :rtype: float\n \n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_71ring_modulate = {"ring_modulate", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_71ring_modulate, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_70ring_modulate};
static PyObject *__pyx_pw_8pysndlib_3clm_71ring_modulate(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
double __pyx_v_s1;
double __pyx_v_s2;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("ring_modulate (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_s1,&__pyx_n_s_s2,0};
PyObject* values[2] = {0,0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_s1)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1250, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_s2)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1250, __pyx_L3_error)
else {
__Pyx_RaiseArgtupleInvalid("ring_modulate", 1, 2, 2, 1); __PYX_ERR(0, 1250, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "ring_modulate") < 0)) __PYX_ERR(0, 1250, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 2)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
}
__pyx_v_s1 = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_s1 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1250, __pyx_L3_error)
__pyx_v_s2 = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_s2 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1250, __pyx_L3_error)
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("ring_modulate", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 1250, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.ring_modulate", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_8pysndlib_3clm_70ring_modulate(__pyx_self, __pyx_v_s1, __pyx_v_s2);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_70ring_modulate(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_s1, double __pyx_v_s2) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8pysndlib_3clm_ring_modulate(__pyx_v_s1, __pyx_v_s2, 0); if (unlikely(__pyx_t_1 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1250, __pyx_L1_error)
__pyx_t_2 = PyFloat_FromDouble(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1250, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("pysndlib.clm.ring_modulate", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_tuple__201 = PyTuple_Pack(2, __pyx_n_s_s1, __pyx_n_s_s2); if (unlikely(!__pyx_tuple__201)) __PYX_ERR(0, 1250, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__201);
__Pyx_GIVEREF(__pyx_tuple__201);
/* … */
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_71ring_modulate, 0, __pyx_n_s_ring_modulate, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__202)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 1250, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_ring_modulate, __pyx_t_40) < 0) __PYX_ERR(0, 1250, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
__pyx_codeobj__202 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__201, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_ring_modulate, 1250, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__202)) __PYX_ERR(0, 1250, __pyx_L1_error)
1251: """
1252: return s1 * s2 (sample by sample multiply).
1253:
1254: :param s1: input 1
1255: :param s2: input 2
1256: :return: result
1257: :rtype: float
1258:
1259: """
1260:
+1261: return cclm.mus_ring_modulate(s1, s2)
__pyx_r = mus_ring_modulate(__pyx_v_s1, __pyx_v_s2); goto __pyx_L0;
1262:
+1263: cpdef cython.double amplitude_modulate(cython.double s1, cython.double s2, cython.double s3):
static PyObject *__pyx_pw_8pysndlib_3clm_73amplitude_modulate(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static double __pyx_f_8pysndlib_3clm_amplitude_modulate(double __pyx_v_s1, double __pyx_v_s2, double __pyx_v_s3, CYTHON_UNUSED int __pyx_skip_dispatch) {
double __pyx_r;
/* … */
/* function exit code */
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_73amplitude_modulate(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_72amplitude_modulate, "\n carrier in1 in2): in1 * (carrier + in2).\n \n :param s1: input 1\n :param s2: input 2\n :param s3: input 3\n :return: result\n :rtype: float\n \n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_73amplitude_modulate = {"amplitude_modulate", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_73amplitude_modulate, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_72amplitude_modulate};
static PyObject *__pyx_pw_8pysndlib_3clm_73amplitude_modulate(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
double __pyx_v_s1;
double __pyx_v_s2;
double __pyx_v_s3;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("amplitude_modulate (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_s1,&__pyx_n_s_s2,&__pyx_n_s_s3,0};
PyObject* values[3] = {0,0,0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_s1)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1263, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_s2)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1263, __pyx_L3_error)
else {
__Pyx_RaiseArgtupleInvalid("amplitude_modulate", 1, 3, 3, 1); __PYX_ERR(0, 1263, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 2:
if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_s3)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[2]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1263, __pyx_L3_error)
else {
__Pyx_RaiseArgtupleInvalid("amplitude_modulate", 1, 3, 3, 2); __PYX_ERR(0, 1263, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "amplitude_modulate") < 0)) __PYX_ERR(0, 1263, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 3)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
}
__pyx_v_s1 = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_s1 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1263, __pyx_L3_error)
__pyx_v_s2 = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_s2 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1263, __pyx_L3_error)
__pyx_v_s3 = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_s3 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1263, __pyx_L3_error)
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("amplitude_modulate", 1, 3, 3, __pyx_nargs); __PYX_ERR(0, 1263, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.amplitude_modulate", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_8pysndlib_3clm_72amplitude_modulate(__pyx_self, __pyx_v_s1, __pyx_v_s2, __pyx_v_s3);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_72amplitude_modulate(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_s1, double __pyx_v_s2, double __pyx_v_s3) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8pysndlib_3clm_amplitude_modulate(__pyx_v_s1, __pyx_v_s2, __pyx_v_s3, 0); if (unlikely(__pyx_t_1 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1263, __pyx_L1_error)
__pyx_t_2 = PyFloat_FromDouble(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1263, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("pysndlib.clm.amplitude_modulate", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_tuple__203 = PyTuple_Pack(3, __pyx_n_s_s1, __pyx_n_s_s2, __pyx_n_s_s3); if (unlikely(!__pyx_tuple__203)) __PYX_ERR(0, 1263, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__203);
__Pyx_GIVEREF(__pyx_tuple__203);
/* … */
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_73amplitude_modulate, 0, __pyx_n_s_amplitude_modulate, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__204)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 1263, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_amplitude_modulate, __pyx_t_40) < 0) __PYX_ERR(0, 1263, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
__pyx_codeobj__204 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__203, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_amplitude_modulate, 1263, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__204)) __PYX_ERR(0, 1263, __pyx_L1_error)
1264: """
1265: carrier in1 in2): in1 * (carrier + in2).
1266:
1267: :param s1: input 1
1268: :param s2: input 2
1269: :param s3: input 3
1270: :return: result
1271: :rtype: float
1272:
1273: """
+1274: return cclm.mus_amplitude_modulate(s1, s2, s3)
__pyx_r = mus_amplitude_modulate(__pyx_v_s1, __pyx_v_s2, __pyx_v_s3); goto __pyx_L0;
1275:
+1276: cpdef cython.double contrast_enhancement(cython.double insig, cython.double fm_index= 1.0 ):
static PyObject *__pyx_pw_8pysndlib_3clm_75contrast_enhancement(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static double __pyx_f_8pysndlib_3clm_contrast_enhancement(double __pyx_v_insig, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_8pysndlib_3clm_contrast_enhancement *__pyx_optional_args) {
double __pyx_v_fm_index = ((double)1.0);
double __pyx_r;
if (__pyx_optional_args) {
if (__pyx_optional_args->__pyx_n > 0) {
__pyx_v_fm_index = __pyx_optional_args->fm_index;
}
}
/* … */
/* function exit code */
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_75contrast_enhancement(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_74contrast_enhancement, "\n returns insig (index 1.0)): sin(sig * pi / 2 + fm_index * sin(sig * 2 * pi))\n contrast_enhancement passes its input to sin as a kind of phase modulation.\n \n :param insig: input\n :param fm_index: \n :return: result\n :rtype: float\n \n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_75contrast_enhancement = {"contrast_enhancement", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_75contrast_enhancement, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_74contrast_enhancement};
static PyObject *__pyx_pw_8pysndlib_3clm_75contrast_enhancement(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
double __pyx_v_insig;
double __pyx_v_fm_index;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("contrast_enhancement (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_insig,&__pyx_n_s_fm_index,0};
PyObject* values[2] = {0,0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_insig)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1276, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_fm_index);
if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1276, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "contrast_enhancement") < 0)) __PYX_ERR(0, 1276, __pyx_L3_error)
}
} else {
switch (__pyx_nargs) {
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
break;
default: goto __pyx_L5_argtuple_error;
}
}
__pyx_v_insig = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_insig == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1276, __pyx_L3_error)
if (values[1]) {
__pyx_v_fm_index = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_fm_index == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1276, __pyx_L3_error)
} else {
__pyx_v_fm_index = ((double)1.0);
}
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("contrast_enhancement", 0, 1, 2, __pyx_nargs); __PYX_ERR(0, 1276, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.contrast_enhancement", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_8pysndlib_3clm_74contrast_enhancement(__pyx_self, __pyx_v_insig, __pyx_v_fm_index);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_74contrast_enhancement(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_insig, double __pyx_v_fm_index) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_2.__pyx_n = 1;
__pyx_t_2.fm_index = __pyx_v_fm_index;
__pyx_t_1 = __pyx_f_8pysndlib_3clm_contrast_enhancement(__pyx_v_insig, 0, &__pyx_t_2); if (unlikely(__pyx_t_1 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1276, __pyx_L1_error)
__pyx_t_3 = PyFloat_FromDouble(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1276, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__pyx_r = __pyx_t_3;
__pyx_t_3 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_3);
__Pyx_AddTraceback("pysndlib.clm.contrast_enhancement", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_tuple__205 = PyTuple_Pack(2, __pyx_n_s_insig, __pyx_n_s_fm_index); if (unlikely(!__pyx_tuple__205)) __PYX_ERR(0, 1276, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__205);
__Pyx_GIVEREF(__pyx_tuple__205);
__pyx_codeobj__206 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__205, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_contrast_enhancement, 1276, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__206)) __PYX_ERR(0, 1276, __pyx_L1_error)
/* … */
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_75contrast_enhancement, 0, __pyx_n_s_contrast_enhancement, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__206)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 1276, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
__Pyx_CyFunction_SetDefaultsTuple(__pyx_t_40, __pyx_tuple__207);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_contrast_enhancement, __pyx_t_40) < 0) __PYX_ERR(0, 1276, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
__pyx_tuple__207 = PyTuple_Pack(1, __pyx_float_1_0); if (unlikely(!__pyx_tuple__207)) __PYX_ERR(0, 1276, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__207);
__Pyx_GIVEREF(__pyx_tuple__207);
1277: """
1278: returns insig (index 1.0)): sin(sig * pi / 2 + fm_index * sin(sig * 2 * pi))
1279: contrast_enhancement passes its input to sin as a kind of phase modulation.
1280:
1281: :param insig: input
1282: :param fm_index:
1283: :return: result
1284: :rtype: float
1285:
1286: """
+1287: return cclm.mus_contrast_enhancement(insig, fm_index)
__pyx_r = mus_contrast_enhancement(__pyx_v_insig, __pyx_v_fm_index); goto __pyx_L0;
1288:
1289:
+1290: cpdef cython.double dot_product(np.ndarray data1, np.ndarray data2):
static PyObject *__pyx_pw_8pysndlib_3clm_77dot_product(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static double __pyx_f_8pysndlib_3clm_dot_product(PyArrayObject *__pyx_v_data1, PyArrayObject *__pyx_v_data2, CYTHON_UNUSED int __pyx_skip_dispatch) {
__Pyx_memviewslice __pyx_v_data1_view = { 0, 0, { 0 }, { 0 }, { 0 } };
__Pyx_memviewslice __pyx_v_data2_view = { 0, 0, { 0 }, { 0 }, { 0 } };
double __pyx_r;
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__PYX_XCLEAR_MEMVIEW(&__pyx_t_2, 1);
__Pyx_AddTraceback("pysndlib.clm.dot_product", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = -1;
__pyx_L0:;
__PYX_XCLEAR_MEMVIEW(&__pyx_v_data1_view, 1);
__PYX_XCLEAR_MEMVIEW(&__pyx_v_data2_view, 1);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_77dot_product(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_76dot_product, "\n returns v1 v2 (size)): sum of v1[i] * v2[i] (also named scalar product).\n \n :param data1: input 1\n :param data2: input 2\n :return: result\n :rtype: float\n \n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_77dot_product = {"dot_product", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_77dot_product, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_76dot_product};
static PyObject *__pyx_pw_8pysndlib_3clm_77dot_product(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
PyArrayObject *__pyx_v_data1 = 0;
PyArrayObject *__pyx_v_data2 = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("dot_product (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_data1,&__pyx_n_s_data2,0};
PyObject* values[2] = {0,0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_data1)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1290, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_data2)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1290, __pyx_L3_error)
else {
__Pyx_RaiseArgtupleInvalid("dot_product", 1, 2, 2, 1); __PYX_ERR(0, 1290, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "dot_product") < 0)) __PYX_ERR(0, 1290, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 2)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
}
__pyx_v_data1 = ((PyArrayObject *)values[0]);
__pyx_v_data2 = ((PyArrayObject *)values[1]);
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("dot_product", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 1290, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.dot_product", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_data1), __pyx_ptype_5numpy_ndarray, 1, "data1", 0))) __PYX_ERR(0, 1290, __pyx_L1_error)
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_data2), __pyx_ptype_5numpy_ndarray, 1, "data2", 0))) __PYX_ERR(0, 1290, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_76dot_product(__pyx_self, __pyx_v_data1, __pyx_v_data2);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_76dot_product(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_data1, PyArrayObject *__pyx_v_data2) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8pysndlib_3clm_dot_product(__pyx_v_data1, __pyx_v_data2, 0); if (unlikely(__pyx_t_1 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1290, __pyx_L1_error)
__pyx_t_2 = PyFloat_FromDouble(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1290, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("pysndlib.clm.dot_product", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_tuple__208 = PyTuple_Pack(2, __pyx_n_s_data1, __pyx_n_s_data2); if (unlikely(!__pyx_tuple__208)) __PYX_ERR(0, 1290, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__208);
__Pyx_GIVEREF(__pyx_tuple__208);
/* … */
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_77dot_product, 0, __pyx_n_s_dot_product, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__209)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 1290, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_dot_product, __pyx_t_40) < 0) __PYX_ERR(0, 1290, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
__pyx_codeobj__209 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__208, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_dot_product, 1290, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__209)) __PYX_ERR(0, 1290, __pyx_L1_error)
1291: """
1292: returns v1 v2 (size)): sum of v1[i] * v2[i] (also named scalar product).
1293:
1294: :param data1: input 1
1295: :param data2: input 2
1296: :return: result
1297: :rtype: float
1298:
1299: """
+1300: check_ndim(data1)
__pyx_t_1 = __pyx_f_8pysndlib_3clm_check_ndim(((PyObject *)__pyx_v_data1), 0, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1300, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+1301: check_ndim(data2)
__pyx_t_1 = __pyx_f_8pysndlib_3clm_check_ndim(((PyObject *)__pyx_v_data2), 0, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1301, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+1302: compare_shapes(data1, data2)
__pyx_t_1 = __pyx_f_8pysndlib_3clm_compare_shapes(((PyObject *)__pyx_v_data1), ((PyObject *)__pyx_v_data2), 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1302, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
1303:
+1304: cdef double [:] data1_view = data1
__pyx_t_2 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(((PyObject *)__pyx_v_data1), PyBUF_WRITABLE); if (unlikely(!__pyx_t_2.memview)) __PYX_ERR(0, 1304, __pyx_L1_error) __pyx_v_data1_view = __pyx_t_2; __pyx_t_2.memview = NULL; __pyx_t_2.data = NULL;
+1305: cdef double [:] data2_view = data2
__pyx_t_2 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(((PyObject *)__pyx_v_data2), PyBUF_WRITABLE); if (unlikely(!__pyx_t_2.memview)) __PYX_ERR(0, 1305, __pyx_L1_error) __pyx_v_data2_view = __pyx_t_2; __pyx_t_2.memview = NULL; __pyx_t_2.data = NULL;
+1306: return cclm.mus_dot_product(&data1_view[0], &data2_view[0], len(data1))
__pyx_t_3 = 0;
__pyx_t_4 = -1;
if (__pyx_t_3 < 0) {
__pyx_t_3 += __pyx_v_data1_view.shape[0];
if (unlikely(__pyx_t_3 < 0)) __pyx_t_4 = 0;
} else if (unlikely(__pyx_t_3 >= __pyx_v_data1_view.shape[0])) __pyx_t_4 = 0;
if (unlikely(__pyx_t_4 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_4);
__PYX_ERR(0, 1306, __pyx_L1_error)
}
__pyx_t_5 = 0;
__pyx_t_4 = -1;
if (__pyx_t_5 < 0) {
__pyx_t_5 += __pyx_v_data2_view.shape[0];
if (unlikely(__pyx_t_5 < 0)) __pyx_t_4 = 0;
} else if (unlikely(__pyx_t_5 >= __pyx_v_data2_view.shape[0])) __pyx_t_4 = 0;
if (unlikely(__pyx_t_4 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_4);
__PYX_ERR(0, 1306, __pyx_L1_error)
}
__pyx_t_6 = PyObject_Length(((PyObject *)__pyx_v_data1)); if (unlikely(__pyx_t_6 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1306, __pyx_L1_error)
__pyx_r = mus_dot_product((&(*((double *) ( /* dim=0 */ (__pyx_v_data1_view.data + __pyx_t_3 * __pyx_v_data1_view.strides[0]) )))), (&(*((double *) ( /* dim=0 */ (__pyx_v_data2_view.data + __pyx_t_5 * __pyx_v_data2_view.strides[0]) )))), __pyx_t_6);
goto __pyx_L0;
1307:
1308: # changed 11-26-23 to not modify inplace
+1309: cpdef cython.double polynomial(np.ndarray coeffs, np.ndarray x ):
static PyObject *__pyx_pw_8pysndlib_3clm_79polynomial(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static double __pyx_f_8pysndlib_3clm_polynomial(PyArrayObject *__pyx_v_coeffs, PyArrayObject *__pyx_v_x, CYTHON_UNUSED int __pyx_skip_dispatch) {
__Pyx_memviewslice __pyx_v_coeffs_view = { 0, 0, { 0 }, { 0 }, { 0 } };
double __pyx_r;
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__PYX_XCLEAR_MEMVIEW(&__pyx_t_2, 1);
__Pyx_AddTraceback("pysndlib.clm.polynomial", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = -1;
__pyx_L0:;
__PYX_XCLEAR_MEMVIEW(&__pyx_v_coeffs_view, 1);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_79polynomial(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_78polynomial, "\n evaluate a polynomial at x. coeffs are in order of degree, so coeff[0] is the constant term.\n \n :param coeffs: coefficients where coeffs[0] is the constant term, and so on.\n :param x: input\n :return: result\n :rtype: float\n \n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_79polynomial = {"polynomial", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_79polynomial, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_78polynomial};
static PyObject *__pyx_pw_8pysndlib_3clm_79polynomial(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
PyArrayObject *__pyx_v_coeffs = 0;
PyArrayObject *__pyx_v_x = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("polynomial (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_coeffs,&__pyx_n_s_x,0};
PyObject* values[2] = {0,0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_coeffs)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1309, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_x)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1309, __pyx_L3_error)
else {
__Pyx_RaiseArgtupleInvalid("polynomial", 1, 2, 2, 1); __PYX_ERR(0, 1309, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "polynomial") < 0)) __PYX_ERR(0, 1309, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 2)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
}
__pyx_v_coeffs = ((PyArrayObject *)values[0]);
__pyx_v_x = ((PyArrayObject *)values[1]);
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("polynomial", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 1309, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.polynomial", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_coeffs), __pyx_ptype_5numpy_ndarray, 1, "coeffs", 0))) __PYX_ERR(0, 1309, __pyx_L1_error)
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) __PYX_ERR(0, 1309, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_78polynomial(__pyx_self, __pyx_v_coeffs, __pyx_v_x);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_78polynomial(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_coeffs, PyArrayObject *__pyx_v_x) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8pysndlib_3clm_polynomial(__pyx_v_coeffs, __pyx_v_x, 0); if (unlikely(__pyx_t_1 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1309, __pyx_L1_error)
__pyx_t_2 = PyFloat_FromDouble(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1309, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("pysndlib.clm.polynomial", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_tuple__210 = PyTuple_Pack(2, __pyx_n_s_coeffs, __pyx_n_s_x); if (unlikely(!__pyx_tuple__210)) __PYX_ERR(0, 1309, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__210);
__Pyx_GIVEREF(__pyx_tuple__210);
/* … */
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_79polynomial, 0, __pyx_n_s_polynomial, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__211)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 1309, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_polynomial, __pyx_t_40) < 0) __PYX_ERR(0, 1309, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
__pyx_codeobj__211 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__210, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_polynomial, 1309, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__211)) __PYX_ERR(0, 1309, __pyx_L1_error)
1310: """
1311: evaluate a polynomial at x. coeffs are in order of degree, so coeff[0] is the constant term.
1312:
1313: :param coeffs: coefficients where coeffs[0] is the constant term, and so on.
1314: :param x: input
1315: :return: result
1316: :rtype: float
1317:
1318: """
+1319: check_ndim(coeffs)
__pyx_t_1 = __pyx_f_8pysndlib_3clm_check_ndim(((PyObject *)__pyx_v_coeffs), 0, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1319, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+1320: cdef double [:] coeffs_view = coeffs
__pyx_t_2 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(((PyObject *)__pyx_v_coeffs), PyBUF_WRITABLE); if (unlikely(!__pyx_t_2.memview)) __PYX_ERR(0, 1320, __pyx_L1_error) __pyx_v_coeffs_view = __pyx_t_2; __pyx_t_2.memview = NULL; __pyx_t_2.data = NULL;
+1321: return cclm.mus_polynomial(&coeffs_view[0], x, len(coeffs))
__pyx_t_3 = 0;
__pyx_t_4 = -1;
if (__pyx_t_3 < 0) {
__pyx_t_3 += __pyx_v_coeffs_view.shape[0];
if (unlikely(__pyx_t_3 < 0)) __pyx_t_4 = 0;
} else if (unlikely(__pyx_t_3 >= __pyx_v_coeffs_view.shape[0])) __pyx_t_4 = 0;
if (unlikely(__pyx_t_4 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_4);
__PYX_ERR(0, 1321, __pyx_L1_error)
}
__pyx_t_5 = __pyx_PyFloat_AsDouble(((PyObject *)__pyx_v_x)); if (unlikely((__pyx_t_5 == ((mus_float_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1321, __pyx_L1_error)
__pyx_t_6 = PyObject_Length(((PyObject *)__pyx_v_coeffs)); if (unlikely(__pyx_t_6 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1321, __pyx_L1_error)
__pyx_r = mus_polynomial((&(*((double *) ( /* dim=0 */ (__pyx_v_coeffs_view.data + __pyx_t_3 * __pyx_v_coeffs_view.strides[0]) )))), __pyx_t_5, __pyx_t_6);
goto __pyx_L0;
1322:
+1323: cpdef cython.double array_interp(np.ndarray fn, cython.double x):
static PyObject *__pyx_pw_8pysndlib_3clm_81array_interp(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static double __pyx_f_8pysndlib_3clm_array_interp(PyArrayObject *__pyx_v_fn, double __pyx_v_x, CYTHON_UNUSED int __pyx_skip_dispatch) {
__Pyx_memviewslice __pyx_v_fn_view = { 0, 0, { 0 }, { 0 }, { 0 } };
double __pyx_r;
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__PYX_XCLEAR_MEMVIEW(&__pyx_t_2, 1);
__Pyx_AddTraceback("pysndlib.clm.array_interp", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = -1;
__pyx_L0:;
__PYX_XCLEAR_MEMVIEW(&__pyx_v_fn_view, 1);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_81array_interp(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_80array_interp, "\n taking into account wrap-around (size is size of data), with linear interpolation if phase is not an integer.\n \n :param fn: input array\n :param x: interp point\n :return: result\n :rtype: float\n \n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_81array_interp = {"array_interp", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_81array_interp, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_80array_interp};
static PyObject *__pyx_pw_8pysndlib_3clm_81array_interp(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
PyArrayObject *__pyx_v_fn = 0;
double __pyx_v_x;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("array_interp (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_fn,&__pyx_n_s_x,0};
PyObject* values[2] = {0,0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_fn)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1323, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_x)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1323, __pyx_L3_error)
else {
__Pyx_RaiseArgtupleInvalid("array_interp", 1, 2, 2, 1); __PYX_ERR(0, 1323, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "array_interp") < 0)) __PYX_ERR(0, 1323, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 2)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
}
__pyx_v_fn = ((PyArrayObject *)values[0]);
__pyx_v_x = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_x == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1323, __pyx_L3_error)
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("array_interp", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 1323, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.array_interp", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_fn), __pyx_ptype_5numpy_ndarray, 1, "fn", 0))) __PYX_ERR(0, 1323, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_80array_interp(__pyx_self, __pyx_v_fn, __pyx_v_x);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_80array_interp(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_fn, double __pyx_v_x) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8pysndlib_3clm_array_interp(__pyx_v_fn, __pyx_v_x, 0); if (unlikely(__pyx_t_1 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1323, __pyx_L1_error)
__pyx_t_2 = PyFloat_FromDouble(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1323, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("pysndlib.clm.array_interp", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_tuple__212 = PyTuple_Pack(2, __pyx_n_s_fn, __pyx_n_s_x); if (unlikely(!__pyx_tuple__212)) __PYX_ERR(0, 1323, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__212);
__Pyx_GIVEREF(__pyx_tuple__212);
/* … */
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_81array_interp, 0, __pyx_n_s_array_interp, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__213)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 1323, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_array_interp, __pyx_t_40) < 0) __PYX_ERR(0, 1323, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
__pyx_codeobj__213 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__212, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_array_interp, 1323, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__213)) __PYX_ERR(0, 1323, __pyx_L1_error)
1324: """
1325: taking into account wrap-around (size is size of data), with linear interpolation if phase is not an integer.
1326:
1327: :param fn: input array
1328: :param x: interp point
1329: :return: result
1330: :rtype: float
1331:
1332: """
+1333: check_ndim(fn)
__pyx_t_1 = __pyx_f_8pysndlib_3clm_check_ndim(((PyObject *)__pyx_v_fn), 0, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1333, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+1334: cdef double [:] fn_view = fn
__pyx_t_2 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(((PyObject *)__pyx_v_fn), PyBUF_WRITABLE); if (unlikely(!__pyx_t_2.memview)) __PYX_ERR(0, 1334, __pyx_L1_error) __pyx_v_fn_view = __pyx_t_2; __pyx_t_2.memview = NULL; __pyx_t_2.data = NULL;
+1335: return cclm.mus_array_interp(&fn_view[0], x, len(fn))
__pyx_t_3 = 0;
__pyx_t_4 = -1;
if (__pyx_t_3 < 0) {
__pyx_t_3 += __pyx_v_fn_view.shape[0];
if (unlikely(__pyx_t_3 < 0)) __pyx_t_4 = 0;
} else if (unlikely(__pyx_t_3 >= __pyx_v_fn_view.shape[0])) __pyx_t_4 = 0;
if (unlikely(__pyx_t_4 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_4);
__PYX_ERR(0, 1335, __pyx_L1_error)
}
__pyx_t_5 = PyObject_Length(((PyObject *)__pyx_v_fn)); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1335, __pyx_L1_error)
__pyx_r = mus_array_interp((&(*((double *) ( /* dim=0 */ (__pyx_v_fn_view.data + __pyx_t_3 * __pyx_v_fn_view.strides[0]) )))), __pyx_v_x, __pyx_t_5);
goto __pyx_L0;
1336:
+1337: cpdef cython.double bessi0(cython.double x):
static PyObject *__pyx_pw_8pysndlib_3clm_83bessi0(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static double __pyx_f_8pysndlib_3clm_bessi0(double __pyx_v_x, CYTHON_UNUSED int __pyx_skip_dispatch) {
double __pyx_r;
/* … */
/* function exit code */
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_83bessi0(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_82bessi0, "\n bessel function of zeroth order\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_83bessi0 = {"bessi0", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_83bessi0, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_82bessi0};
static PyObject *__pyx_pw_8pysndlib_3clm_83bessi0(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
double __pyx_v_x;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("bessi0 (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,0};
PyObject* values[1] = {0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_x)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1337, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "bessi0") < 0)) __PYX_ERR(0, 1337, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 1)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
}
__pyx_v_x = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_x == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1337, __pyx_L3_error)
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("bessi0", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 1337, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.bessi0", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_8pysndlib_3clm_82bessi0(__pyx_self, __pyx_v_x);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_82bessi0(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_x) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8pysndlib_3clm_bessi0(__pyx_v_x, 0); if (unlikely(__pyx_t_1 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1337, __pyx_L1_error)
__pyx_t_2 = PyFloat_FromDouble(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1337, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("pysndlib.clm.bessi0", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_83bessi0, 0, __pyx_n_s_bessi0, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__214)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 1337, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_bessi0, __pyx_t_40) < 0) __PYX_ERR(0, 1337, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
/* … */
__pyx_codeobj__214 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__151, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_bessi0, 1337, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__214)) __PYX_ERR(0, 1337, __pyx_L1_error)
1338: """
1339: bessel function of zeroth order
1340: """
+1341: return cclm.mus_bessi0(x)
__pyx_r = mus_bessi0(__pyx_v_x); goto __pyx_L0;
1342:
+1343: cpdef cython.double mus_interpolate(Interp interp_type, cython.double x, np.ndarray table, cython.double y1 =0.):
static PyObject *__pyx_pw_8pysndlib_3clm_85mus_interpolate(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static double __pyx_f_8pysndlib_3clm_mus_interpolate(enum __pyx_t_8pysndlib_3clm_Interp __pyx_v_interp_type, double __pyx_v_x, PyArrayObject *__pyx_v_table, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_8pysndlib_3clm_mus_interpolate *__pyx_optional_args) {
double __pyx_v_y1 = ((double)0.);
__Pyx_memviewslice __pyx_v_table_view = { 0, 0, { 0 }, { 0 }, { 0 } };
double __pyx_r;
if (__pyx_optional_args) {
if (__pyx_optional_args->__pyx_n > 0) {
__pyx_v_y1 = __pyx_optional_args->y1;
}
}
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__PYX_XCLEAR_MEMVIEW(&__pyx_t_2, 1);
__Pyx_AddTraceback("pysndlib.clm.mus_interpolate", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = -1;
__pyx_L0:;
__PYX_XCLEAR_MEMVIEW(&__pyx_v_table_view, 1);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_85mus_interpolate(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_84mus_interpolate, "\n interpolate in data ('table' is a ndarray) using interpolation 'type', such as Interp.linear.\n \n :param interp_type: type of interpolation\n :param x: interpolation value\n :param table: table to interpolate in\n :return: result\n :rtype: float\n \n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_85mus_interpolate = {"mus_interpolate", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_85mus_interpolate, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_84mus_interpolate};
static PyObject *__pyx_pw_8pysndlib_3clm_85mus_interpolate(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
enum __pyx_t_8pysndlib_3clm_Interp __pyx_v_interp_type;
double __pyx_v_x;
PyArrayObject *__pyx_v_table = 0;
double __pyx_v_y1;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("mus_interpolate (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_interp_type,&__pyx_n_s_x,&__pyx_n_s_table,&__pyx_n_s_y1,0};
PyObject* values[4] = {0,0,0,0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
CYTHON_FALLTHROUGH;
case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_interp_type)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1343, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_x)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1343, __pyx_L3_error)
else {
__Pyx_RaiseArgtupleInvalid("mus_interpolate", 0, 3, 4, 1); __PYX_ERR(0, 1343, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 2:
if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_table)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[2]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1343, __pyx_L3_error)
else {
__Pyx_RaiseArgtupleInvalid("mus_interpolate", 0, 3, 4, 2); __PYX_ERR(0, 1343, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 3:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_y1);
if (value) { values[3] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1343, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "mus_interpolate") < 0)) __PYX_ERR(0, 1343, __pyx_L3_error)
}
} else {
switch (__pyx_nargs) {
case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
CYTHON_FALLTHROUGH;
case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
break;
default: goto __pyx_L5_argtuple_error;
}
}
__pyx_v_interp_type = ((enum __pyx_t_8pysndlib_3clm_Interp)__Pyx_PyInt_As_enum____pyx_t_8pysndlib_3clm_Interp(values[0])); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1343, __pyx_L3_error)
__pyx_v_x = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_x == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1343, __pyx_L3_error)
__pyx_v_table = ((PyArrayObject *)values[2]);
if (values[3]) {
__pyx_v_y1 = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_y1 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1343, __pyx_L3_error)
} else {
__pyx_v_y1 = ((double)0.);
}
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("mus_interpolate", 0, 3, 4, __pyx_nargs); __PYX_ERR(0, 1343, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.mus_interpolate", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_table), __pyx_ptype_5numpy_ndarray, 1, "table", 0))) __PYX_ERR(0, 1343, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_84mus_interpolate(__pyx_self, __pyx_v_interp_type, __pyx_v_x, __pyx_v_table, __pyx_v_y1);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_84mus_interpolate(CYTHON_UNUSED PyObject *__pyx_self, enum __pyx_t_8pysndlib_3clm_Interp __pyx_v_interp_type, double __pyx_v_x, PyArrayObject *__pyx_v_table, double __pyx_v_y1) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_2.__pyx_n = 1;
__pyx_t_2.y1 = __pyx_v_y1;
__pyx_t_1 = __pyx_f_8pysndlib_3clm_mus_interpolate(__pyx_v_interp_type, __pyx_v_x, __pyx_v_table, 0, &__pyx_t_2); if (unlikely(__pyx_t_1 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1343, __pyx_L1_error)
__pyx_t_3 = PyFloat_FromDouble(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1343, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__pyx_r = __pyx_t_3;
__pyx_t_3 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_3);
__Pyx_AddTraceback("pysndlib.clm.mus_interpolate", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_tuple__215 = PyTuple_Pack(4, __pyx_n_s_interp_type, __pyx_n_s_x, __pyx_n_s_table, __pyx_n_s_y1); if (unlikely(!__pyx_tuple__215)) __PYX_ERR(0, 1343, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__215);
__Pyx_GIVEREF(__pyx_tuple__215);
__pyx_codeobj__216 = (PyObject*)__Pyx_PyCode_New(4, 0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__215, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_mus_interpolate, 1343, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__216)) __PYX_ERR(0, 1343, __pyx_L1_error)
/* … */
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_85mus_interpolate, 0, __pyx_n_s_mus_interpolate, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__216)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 1343, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
__Pyx_CyFunction_SetDefaultsTuple(__pyx_t_40, __pyx_tuple__217);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_mus_interpolate, __pyx_t_40) < 0) __PYX_ERR(0, 1343, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
__pyx_tuple__217 = PyTuple_Pack(1, __pyx_float_0_); if (unlikely(!__pyx_tuple__217)) __PYX_ERR(0, 1343, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__217);
__Pyx_GIVEREF(__pyx_tuple__217);
1344: """
1345: interpolate in data ('table' is a ndarray) using interpolation 'type', such as Interp.linear.
1346:
1347: :param interp_type: type of interpolation
1348: :param x: interpolation value
1349: :param table: table to interpolate in
1350: :return: result
1351: :rtype: float
1352:
1353: """
+1354: check_ndim(table)
__pyx_t_1 = __pyx_f_8pysndlib_3clm_check_ndim(((PyObject *)__pyx_v_table), 0, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1354, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+1355: cdef double [:] table_view = table
__pyx_t_2 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(((PyObject *)__pyx_v_table), PyBUF_WRITABLE); if (unlikely(!__pyx_t_2.memview)) __PYX_ERR(0, 1355, __pyx_L1_error) __pyx_v_table_view = __pyx_t_2; __pyx_t_2.memview = NULL; __pyx_t_2.data = NULL;
+1356: return cclm.mus_interpolate(<cclm.mus_interp_t>interp_type, x, &table_view[0], len(table), y1)
__pyx_t_3 = 0;
__pyx_t_4 = -1;
if (__pyx_t_3 < 0) {
__pyx_t_3 += __pyx_v_table_view.shape[0];
if (unlikely(__pyx_t_3 < 0)) __pyx_t_4 = 0;
} else if (unlikely(__pyx_t_3 >= __pyx_v_table_view.shape[0])) __pyx_t_4 = 0;
if (unlikely(__pyx_t_4 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_4);
__PYX_ERR(0, 1356, __pyx_L1_error)
}
__pyx_t_5 = PyObject_Length(((PyObject *)__pyx_v_table)); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1356, __pyx_L1_error)
__pyx_r = mus_interpolate(((mus_interp_t)__pyx_v_interp_type), __pyx_v_x, (&(*((double *) ( /* dim=0 */ (__pyx_v_table_view.data + __pyx_t_3 * __pyx_v_table_view.strides[0]) )))), __pyx_t_5, __pyx_v_y1);
goto __pyx_L0;
1357:
+1358: cpdef np.ndarray make_fft_window(Window window_type, cython.int size, cython.double beta=0.0 , cython.double alpha=0.0):
static PyObject *__pyx_pw_8pysndlib_3clm_87make_fft_window(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyArrayObject *__pyx_f_8pysndlib_3clm_make_fft_window(enum __pyx_t_8pysndlib_3clm_Window __pyx_v_window_type, int __pyx_v_size, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_8pysndlib_3clm_make_fft_window *__pyx_optional_args) {
double __pyx_v_beta = ((double)0.0);
double __pyx_v_alpha = ((double)0.0);
PyObject *__pyx_v_win = NULL;
__Pyx_memviewslice __pyx_v_win_view = { 0, 0, { 0 }, { 0 }, { 0 } };
PyArrayObject *__pyx_r = NULL;
if (__pyx_optional_args) {
if (__pyx_optional_args->__pyx_n > 0) {
__pyx_v_beta = __pyx_optional_args->beta;
if (__pyx_optional_args->__pyx_n > 1) {
__pyx_v_alpha = __pyx_optional_args->alpha;
}
}
}
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_XDECREF(__pyx_t_5);
__PYX_XCLEAR_MEMVIEW(&__pyx_t_6, 1);
__Pyx_AddTraceback("pysndlib.clm.make_fft_window", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XDECREF(__pyx_v_win);
__PYX_XCLEAR_MEMVIEW(&__pyx_v_win_view, 1);
__Pyx_XGIVEREF((PyObject *)__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_87make_fft_window(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_86make_fft_window, "\n fft data window (a ndarray). type is one of the sndlib fft window identifiers such as\n window.kaiser, beta is the window family parameter, if any.\n \n :param window_type: type of window\n :param size: window size\n :param beta: beta parameter if needed\n :param alpha: alpha parameter if needed\n :return: window\n :rtype: np.ndarray\n \n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_87make_fft_window = {"make_fft_window", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_87make_fft_window, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_86make_fft_window};
static PyObject *__pyx_pw_8pysndlib_3clm_87make_fft_window(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
enum __pyx_t_8pysndlib_3clm_Window __pyx_v_window_type;
int __pyx_v_size;
double __pyx_v_beta;
double __pyx_v_alpha;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("make_fft_window (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_window_type,&__pyx_n_s_size,&__pyx_n_s_beta,&__pyx_n_s_alpha,0};
PyObject* values[4] = {0,0,0,0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
CYTHON_FALLTHROUGH;
case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_window_type)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1358, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_size)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1358, __pyx_L3_error)
else {
__Pyx_RaiseArgtupleInvalid("make_fft_window", 0, 2, 4, 1); __PYX_ERR(0, 1358, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 2:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_beta);
if (value) { values[2] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1358, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 3:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_alpha);
if (value) { values[3] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1358, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "make_fft_window") < 0)) __PYX_ERR(0, 1358, __pyx_L3_error)
}
} else {
switch (__pyx_nargs) {
case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
CYTHON_FALLTHROUGH;
case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
break;
default: goto __pyx_L5_argtuple_error;
}
}
__pyx_v_window_type = ((enum __pyx_t_8pysndlib_3clm_Window)__Pyx_PyInt_As_enum____pyx_t_8pysndlib_3clm_Window(values[0])); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1358, __pyx_L3_error)
__pyx_v_size = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_size == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1358, __pyx_L3_error)
if (values[2]) {
__pyx_v_beta = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_beta == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1358, __pyx_L3_error)
} else {
__pyx_v_beta = ((double)0.0);
}
if (values[3]) {
__pyx_v_alpha = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_alpha == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1358, __pyx_L3_error)
} else {
__pyx_v_alpha = ((double)0.0);
}
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("make_fft_window", 0, 2, 4, __pyx_nargs); __PYX_ERR(0, 1358, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.make_fft_window", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_8pysndlib_3clm_86make_fft_window(__pyx_self, __pyx_v_window_type, __pyx_v_size, __pyx_v_beta, __pyx_v_alpha);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_86make_fft_window(CYTHON_UNUSED PyObject *__pyx_self, enum __pyx_t_8pysndlib_3clm_Window __pyx_v_window_type, int __pyx_v_size, double __pyx_v_beta, double __pyx_v_alpha) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_2.__pyx_n = 2;
__pyx_t_2.beta = __pyx_v_beta;
__pyx_t_2.alpha = __pyx_v_alpha;
__pyx_t_1 = ((PyObject *)__pyx_f_8pysndlib_3clm_make_fft_window(__pyx_v_window_type, __pyx_v_size, 0, &__pyx_t_2)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1358, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("pysndlib.clm.make_fft_window", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_tuple__218 = PyTuple_Pack(4, __pyx_n_s_window_type, __pyx_n_s_size, __pyx_n_s_beta, __pyx_n_s_alpha); if (unlikely(!__pyx_tuple__218)) __PYX_ERR(0, 1358, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__218);
__Pyx_GIVEREF(__pyx_tuple__218);
__pyx_codeobj__219 = (PyObject*)__Pyx_PyCode_New(4, 0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__218, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_make_fft_window, 1358, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__219)) __PYX_ERR(0, 1358, __pyx_L1_error)
/* … */
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_87make_fft_window, 0, __pyx_n_s_make_fft_window, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__219)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 1358, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
__Pyx_CyFunction_SetDefaultsTuple(__pyx_t_40, __pyx_tuple__220);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_make_fft_window, __pyx_t_40) < 0) __PYX_ERR(0, 1358, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
__pyx_tuple__220 = PyTuple_Pack(2, __pyx_float_0_0, __pyx_float_0_0); if (unlikely(!__pyx_tuple__220)) __PYX_ERR(0, 1358, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__220);
__Pyx_GIVEREF(__pyx_tuple__220);
1359: """
1360: fft data window (a ndarray). type is one of the sndlib fft window identifiers such as
1361: window.kaiser, beta is the window family parameter, if any.
1362:
1363: :param window_type: type of window
1364: :param size: window size
1365: :param beta: beta parameter if needed
1366: :param alpha: alpha parameter if needed
1367: :return: window
1368: :rtype: np.ndarray
1369:
1370: """
+1371: win = np.zeros(size, dtype=np.double)
__Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1371, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_zeros); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1371, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1371, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1371, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_GIVEREF(__pyx_t_1); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1)) __PYX_ERR(0, 1371, __pyx_L1_error); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1371, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1371, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_double); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1371, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_t_5) < 0) __PYX_ERR(0, 1371, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1371, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_win = __pyx_t_5; __pyx_t_5 = 0;
+1372: check_ndim(win)
__pyx_t_5 = __pyx_f_8pysndlib_3clm_check_ndim(__pyx_v_win, 0, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1372, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
1373:
+1374: cdef double [:] win_view = win
__pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_v_win, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 1374, __pyx_L1_error) __pyx_v_win_view = __pyx_t_6; __pyx_t_6.memview = NULL; __pyx_t_6.data = NULL;
+1375: cclm.mus_make_fft_window_with_window(<cclm.mus_fft_window_t>window_type, size, beta, alpha, &win_view[0])
__pyx_t_7 = 0;
__pyx_t_8 = -1;
if (__pyx_t_7 < 0) {
__pyx_t_7 += __pyx_v_win_view.shape[0];
if (unlikely(__pyx_t_7 < 0)) __pyx_t_8 = 0;
} else if (unlikely(__pyx_t_7 >= __pyx_v_win_view.shape[0])) __pyx_t_8 = 0;
if (unlikely(__pyx_t_8 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_8);
__PYX_ERR(0, 1375, __pyx_L1_error)
}
(void)(mus_make_fft_window_with_window(((mus_fft_window_t)__pyx_v_window_type), __pyx_v_size, __pyx_v_beta, __pyx_v_alpha, (&(*((double *) ( /* dim=0 */ (__pyx_v_win_view.data + __pyx_t_7 * __pyx_v_win_view.strides[0]) ))))));
+1376: return win
__Pyx_XDECREF((PyObject *)__pyx_r); if (!(likely(((__pyx_v_win) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_win, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1376, __pyx_L1_error) __Pyx_INCREF(__pyx_v_win); __pyx_r = ((PyArrayObject *)__pyx_v_win); goto __pyx_L0;
1377:
+1378: cpdef np.ndarray mus_fft(np.ndarray rdat, np.ndarray idat, cython.int fft_size , cython.int sign):
static PyObject *__pyx_pw_8pysndlib_3clm_89mus_fft(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyArrayObject *__pyx_f_8pysndlib_3clm_mus_fft(PyArrayObject *__pyx_v_rdat, PyArrayObject *__pyx_v_idat, int __pyx_v_fft_size, int __pyx_v_sign, CYTHON_UNUSED int __pyx_skip_dispatch) {
__Pyx_memviewslice __pyx_v_rdat_view = { 0, 0, { 0 }, { 0 }, { 0 } };
__Pyx_memviewslice __pyx_v_idat_view = { 0, 0, { 0 }, { 0 }, { 0 } };
CYTHON_UNUSED PyObject *__pyx_v_res = NULL;
PyArrayObject *__pyx_r = NULL;
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__PYX_XCLEAR_MEMVIEW(&__pyx_t_2, 1);
__Pyx_AddTraceback("pysndlib.clm.mus_fft", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__PYX_XCLEAR_MEMVIEW(&__pyx_v_rdat_view, 1);
__PYX_XCLEAR_MEMVIEW(&__pyx_v_idat_view, 1);
__Pyx_XDECREF(__pyx_v_res);
__Pyx_XGIVEREF((PyObject *)__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_89mus_fft(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_88mus_fft, "\n in-place operation. return the fft of rl and im which contain the real and imaginary parts of the data; len should be a\n power of 2, dir = 1 for fft, -1 for inverse-fft.\n \n :param rdat: real data\n :param imaginary: imaginary data\n :param fft_size: must be power of two\n :param sign: 1 for fft, -1 for inverse-fft\n :return: result written into rdat\n :rtype: np.ndarray\n \n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_89mus_fft = {"mus_fft", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_89mus_fft, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_88mus_fft};
static PyObject *__pyx_pw_8pysndlib_3clm_89mus_fft(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
PyArrayObject *__pyx_v_rdat = 0;
PyArrayObject *__pyx_v_idat = 0;
int __pyx_v_fft_size;
int __pyx_v_sign;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("mus_fft (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_rdat,&__pyx_n_s_idat,&__pyx_n_s_fft_size,&__pyx_n_s_sign,0};
PyObject* values[4] = {0,0,0,0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
CYTHON_FALLTHROUGH;
case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_rdat)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1378, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_idat)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1378, __pyx_L3_error)
else {
__Pyx_RaiseArgtupleInvalid("mus_fft", 1, 4, 4, 1); __PYX_ERR(0, 1378, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 2:
if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_fft_size)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[2]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1378, __pyx_L3_error)
else {
__Pyx_RaiseArgtupleInvalid("mus_fft", 1, 4, 4, 2); __PYX_ERR(0, 1378, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 3:
if (likely((values[3] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_sign)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[3]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1378, __pyx_L3_error)
else {
__Pyx_RaiseArgtupleInvalid("mus_fft", 1, 4, 4, 3); __PYX_ERR(0, 1378, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "mus_fft") < 0)) __PYX_ERR(0, 1378, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 4)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
}
__pyx_v_rdat = ((PyArrayObject *)values[0]);
__pyx_v_idat = ((PyArrayObject *)values[1]);
__pyx_v_fft_size = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_fft_size == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1378, __pyx_L3_error)
__pyx_v_sign = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_sign == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1378, __pyx_L3_error)
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("mus_fft", 1, 4, 4, __pyx_nargs); __PYX_ERR(0, 1378, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.mus_fft", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_rdat), __pyx_ptype_5numpy_ndarray, 1, "rdat", 0))) __PYX_ERR(0, 1378, __pyx_L1_error)
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_idat), __pyx_ptype_5numpy_ndarray, 1, "idat", 0))) __PYX_ERR(0, 1378, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_88mus_fft(__pyx_self, __pyx_v_rdat, __pyx_v_idat, __pyx_v_fft_size, __pyx_v_sign);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_88mus_fft(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_rdat, PyArrayObject *__pyx_v_idat, int __pyx_v_fft_size, int __pyx_v_sign) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = ((PyObject *)__pyx_f_8pysndlib_3clm_mus_fft(__pyx_v_rdat, __pyx_v_idat, __pyx_v_fft_size, __pyx_v_sign, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1378, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("pysndlib.clm.mus_fft", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_tuple__221 = PyTuple_Pack(4, __pyx_n_s_rdat, __pyx_n_s_idat, __pyx_n_s_fft_size, __pyx_n_s_sign); if (unlikely(!__pyx_tuple__221)) __PYX_ERR(0, 1378, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__221);
__Pyx_GIVEREF(__pyx_tuple__221);
/* … */
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_89mus_fft, 0, __pyx_n_s_mus_fft, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__222)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 1378, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_mus_fft, __pyx_t_40) < 0) __PYX_ERR(0, 1378, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
__pyx_codeobj__222 = (PyObject*)__Pyx_PyCode_New(4, 0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__221, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_mus_fft, 1378, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__222)) __PYX_ERR(0, 1378, __pyx_L1_error)
1379: """
1380: in-place operation. return the fft of rl and im which contain the real and imaginary parts of the data; len should be a
1381: power of 2, dir = 1 for fft, -1 for inverse-fft.
1382:
1383: :param rdat: real data
1384: :param imaginary: imaginary data
1385: :param fft_size: must be power of two
1386: :param sign: 1 for fft, -1 for inverse-fft
1387: :return: result written into rdat
1388: :rtype: np.ndarray
1389:
1390: """
+1391: check_ndim(rdat)
__pyx_t_1 = __pyx_f_8pysndlib_3clm_check_ndim(((PyObject *)__pyx_v_rdat), 0, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1391, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+1392: check_ndim(idat)
__pyx_t_1 = __pyx_f_8pysndlib_3clm_check_ndim(((PyObject *)__pyx_v_idat), 0, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1392, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+1393: compare_shapes(rdat, idat)
__pyx_t_1 = __pyx_f_8pysndlib_3clm_compare_shapes(((PyObject *)__pyx_v_rdat), ((PyObject *)__pyx_v_idat), 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1393, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
1394:
+1395: cdef double [:] rdat_view = rdat
__pyx_t_2 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(((PyObject *)__pyx_v_rdat), PyBUF_WRITABLE); if (unlikely(!__pyx_t_2.memview)) __PYX_ERR(0, 1395, __pyx_L1_error) __pyx_v_rdat_view = __pyx_t_2; __pyx_t_2.memview = NULL; __pyx_t_2.data = NULL;
+1396: cdef double [:] idat_view = idat
__pyx_t_2 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(((PyObject *)__pyx_v_idat), PyBUF_WRITABLE); if (unlikely(!__pyx_t_2.memview)) __PYX_ERR(0, 1396, __pyx_L1_error) __pyx_v_idat_view = __pyx_t_2; __pyx_t_2.memview = NULL; __pyx_t_2.data = NULL;
+1397: res = cclm.mus_fft(&rdat_view[0], &idat_view[0], fft_size, sign)
__pyx_t_3 = 0;
__pyx_t_4 = -1;
if (__pyx_t_3 < 0) {
__pyx_t_3 += __pyx_v_rdat_view.shape[0];
if (unlikely(__pyx_t_3 < 0)) __pyx_t_4 = 0;
} else if (unlikely(__pyx_t_3 >= __pyx_v_rdat_view.shape[0])) __pyx_t_4 = 0;
if (unlikely(__pyx_t_4 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_4);
__PYX_ERR(0, 1397, __pyx_L1_error)
}
__pyx_t_5 = 0;
__pyx_t_4 = -1;
if (__pyx_t_5 < 0) {
__pyx_t_5 += __pyx_v_idat_view.shape[0];
if (unlikely(__pyx_t_5 < 0)) __pyx_t_4 = 0;
} else if (unlikely(__pyx_t_5 >= __pyx_v_idat_view.shape[0])) __pyx_t_4 = 0;
if (unlikely(__pyx_t_4 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_4);
__PYX_ERR(0, 1397, __pyx_L1_error)
}
__pyx_t_1 = __Pyx_void_to_None(mus_fft((&(*((double *) ( /* dim=0 */ (__pyx_v_rdat_view.data + __pyx_t_3 * __pyx_v_rdat_view.strides[0]) )))), (&(*((double *) ( /* dim=0 */ (__pyx_v_idat_view.data + __pyx_t_5 * __pyx_v_idat_view.strides[0]) )))), __pyx_v_fft_size, __pyx_v_sign)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1397, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_v_res = __pyx_t_1;
__pyx_t_1 = 0;
+1398: return rdat
__Pyx_XDECREF((PyObject *)__pyx_r); __Pyx_INCREF((PyObject *)__pyx_v_rdat); __pyx_r = __pyx_v_rdat; goto __pyx_L0;
1399:
1400:
+1401: cpdef np.ndarray fft(np.ndarray rdat, np.ndarray idat, cython.int fft_size, cython.int sign ):
static PyObject *__pyx_pw_8pysndlib_3clm_91fft(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyArrayObject *__pyx_f_8pysndlib_3clm_fft(PyArrayObject *__pyx_v_rdat, PyArrayObject *__pyx_v_idat, int __pyx_v_fft_size, int __pyx_v_sign, CYTHON_UNUSED int __pyx_skip_dispatch) {
PyObject *__pyx_v_rdat_cpy = NULL;
PyObject *__pyx_v_idat_cpy = NULL;
__Pyx_memviewslice __pyx_v_rdat_view = { 0, 0, { 0 }, { 0 }, { 0 } };
__Pyx_memviewslice __pyx_v_idat_view = { 0, 0, { 0 }, { 0 }, { 0 } };
CYTHON_UNUSED PyObject *__pyx_v_res = NULL;
PyArrayObject *__pyx_r = NULL;
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__PYX_XCLEAR_MEMVIEW(&__pyx_t_5, 1);
__Pyx_AddTraceback("pysndlib.clm.fft", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XDECREF(__pyx_v_rdat_cpy);
__Pyx_XDECREF(__pyx_v_idat_cpy);
__PYX_XCLEAR_MEMVIEW(&__pyx_v_rdat_view, 1);
__PYX_XCLEAR_MEMVIEW(&__pyx_v_idat_view, 1);
__Pyx_XDECREF(__pyx_v_res);
__Pyx_XGIVEREF((PyObject *)__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_91fft(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_90fft, "\n return the fft of rl and im which contain the real and imaginary parts of the data; len should be a\n power of 2, dir = 1 for fft, -1 for inverse-fft.\n \n :param rdat: real data\n :param imaginary: imaginary data\n :param fft_size: must be power of two\n :param sign: 1 for fft, -1 for inverse-fft\n :return: tuple of copy of rdat and idat\n :rtype: tuple\n \n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_91fft = {"fft", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_91fft, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_90fft};
static PyObject *__pyx_pw_8pysndlib_3clm_91fft(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
PyArrayObject *__pyx_v_rdat = 0;
PyArrayObject *__pyx_v_idat = 0;
int __pyx_v_fft_size;
int __pyx_v_sign;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("fft (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_rdat,&__pyx_n_s_idat,&__pyx_n_s_fft_size,&__pyx_n_s_sign,0};
PyObject* values[4] = {0,0,0,0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
CYTHON_FALLTHROUGH;
case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_rdat)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1401, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_idat)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1401, __pyx_L3_error)
else {
__Pyx_RaiseArgtupleInvalid("fft", 1, 4, 4, 1); __PYX_ERR(0, 1401, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 2:
if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_fft_size)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[2]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1401, __pyx_L3_error)
else {
__Pyx_RaiseArgtupleInvalid("fft", 1, 4, 4, 2); __PYX_ERR(0, 1401, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 3:
if (likely((values[3] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_sign)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[3]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1401, __pyx_L3_error)
else {
__Pyx_RaiseArgtupleInvalid("fft", 1, 4, 4, 3); __PYX_ERR(0, 1401, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "fft") < 0)) __PYX_ERR(0, 1401, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 4)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
}
__pyx_v_rdat = ((PyArrayObject *)values[0]);
__pyx_v_idat = ((PyArrayObject *)values[1]);
__pyx_v_fft_size = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_fft_size == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1401, __pyx_L3_error)
__pyx_v_sign = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_sign == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1401, __pyx_L3_error)
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("fft", 1, 4, 4, __pyx_nargs); __PYX_ERR(0, 1401, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.fft", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_rdat), __pyx_ptype_5numpy_ndarray, 1, "rdat", 0))) __PYX_ERR(0, 1401, __pyx_L1_error)
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_idat), __pyx_ptype_5numpy_ndarray, 1, "idat", 0))) __PYX_ERR(0, 1401, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_90fft(__pyx_self, __pyx_v_rdat, __pyx_v_idat, __pyx_v_fft_size, __pyx_v_sign);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_90fft(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_rdat, PyArrayObject *__pyx_v_idat, int __pyx_v_fft_size, int __pyx_v_sign) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = ((PyObject *)__pyx_f_8pysndlib_3clm_fft(__pyx_v_rdat, __pyx_v_idat, __pyx_v_fft_size, __pyx_v_sign, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1401, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("pysndlib.clm.fft", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_91fft, 0, __pyx_n_s_fft, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__223)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 1401, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_fft, __pyx_t_40) < 0) __PYX_ERR(0, 1401, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
/* … */
__pyx_codeobj__223 = (PyObject*)__Pyx_PyCode_New(4, 0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__221, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_fft, 1401, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__223)) __PYX_ERR(0, 1401, __pyx_L1_error)
1402: """
1403: return the fft of rl and im which contain the real and imaginary parts of the data; len should be a
1404: power of 2, dir = 1 for fft, -1 for inverse-fft.
1405:
1406: :param rdat: real data
1407: :param imaginary: imaginary data
1408: :param fft_size: must be power of two
1409: :param sign: 1 for fft, -1 for inverse-fft
1410: :return: tuple of copy of rdat and idat
1411: :rtype: tuple
1412:
1413: """
+1414: check_ndim(rdat)
__pyx_t_1 = __pyx_f_8pysndlib_3clm_check_ndim(((PyObject *)__pyx_v_rdat), 0, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1414, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+1415: check_ndim(idat)
__pyx_t_1 = __pyx_f_8pysndlib_3clm_check_ndim(((PyObject *)__pyx_v_idat), 0, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1415, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+1416: compare_shapes(rdat, idat)
__pyx_t_1 = __pyx_f_8pysndlib_3clm_compare_shapes(((PyObject *)__pyx_v_rdat), ((PyObject *)__pyx_v_idat), 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1416, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
1417:
+1418: rdat_cpy = np.copy(rdat)
__Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1418, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_copy); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1418, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = NULL; __pyx_t_4 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_3))) { __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_2)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_2); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); __pyx_t_4 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_2, ((PyObject *)__pyx_v_rdat)}; __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1418, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } __pyx_v_rdat_cpy = __pyx_t_1; __pyx_t_1 = 0;
+1419: idat_cpy = np.copy(idat)
__Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1419, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_copy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1419, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = NULL; __pyx_t_4 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_2))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); __pyx_t_4 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_3, ((PyObject *)__pyx_v_idat)}; __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1419, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } __pyx_v_idat_cpy = __pyx_t_1; __pyx_t_1 = 0;
1420:
+1421: cdef double [:] rdat_view = rdat_cpy
__pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_v_rdat_cpy, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(0, 1421, __pyx_L1_error) __pyx_v_rdat_view = __pyx_t_5; __pyx_t_5.memview = NULL; __pyx_t_5.data = NULL;
+1422: cdef double [:] idat_view = idat_cpy
__pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_v_idat_cpy, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(0, 1422, __pyx_L1_error) __pyx_v_idat_view = __pyx_t_5; __pyx_t_5.memview = NULL; __pyx_t_5.data = NULL;
+1423: res = cclm.mus_fft(&rdat_view[0], &idat_view[0], fft_size, sign)
__pyx_t_6 = 0;
__pyx_t_4 = -1;
if (__pyx_t_6 < 0) {
__pyx_t_6 += __pyx_v_rdat_view.shape[0];
if (unlikely(__pyx_t_6 < 0)) __pyx_t_4 = 0;
} else if (unlikely(__pyx_t_6 >= __pyx_v_rdat_view.shape[0])) __pyx_t_4 = 0;
if (unlikely(__pyx_t_4 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_4);
__PYX_ERR(0, 1423, __pyx_L1_error)
}
__pyx_t_7 = 0;
__pyx_t_4 = -1;
if (__pyx_t_7 < 0) {
__pyx_t_7 += __pyx_v_idat_view.shape[0];
if (unlikely(__pyx_t_7 < 0)) __pyx_t_4 = 0;
} else if (unlikely(__pyx_t_7 >= __pyx_v_idat_view.shape[0])) __pyx_t_4 = 0;
if (unlikely(__pyx_t_4 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_4);
__PYX_ERR(0, 1423, __pyx_L1_error)
}
__pyx_t_1 = __Pyx_void_to_None(mus_fft((&(*((double *) ( /* dim=0 */ (__pyx_v_rdat_view.data + __pyx_t_6 * __pyx_v_rdat_view.strides[0]) )))), (&(*((double *) ( /* dim=0 */ (__pyx_v_idat_view.data + __pyx_t_7 * __pyx_v_idat_view.strides[0]) )))), __pyx_v_fft_size, __pyx_v_sign)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1423, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_v_res = __pyx_t_1;
__pyx_t_1 = 0;
+1424: return rdat_cpy, idat_cpy
__Pyx_XDECREF((PyObject *)__pyx_r); __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1424, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_v_rdat_cpy); __Pyx_GIVEREF(__pyx_v_rdat_cpy); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_rdat_cpy)) __PYX_ERR(0, 1424, __pyx_L1_error); __Pyx_INCREF(__pyx_v_idat_cpy); __Pyx_GIVEREF(__pyx_v_idat_cpy); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_idat_cpy)) __PYX_ERR(0, 1424, __pyx_L1_error); if (!(likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray)))) __PYX_ERR(0, 1424, __pyx_L1_error) __pyx_r = ((PyArrayObject *)__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0;
1425:
1426:
1427:
+1428: cpdef np.ndarray mus_rectangular2polar(np.ndarray rdat, np.ndarray idat):
static PyObject *__pyx_pw_8pysndlib_3clm_93mus_rectangular2polar(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyArrayObject *__pyx_f_8pysndlib_3clm_mus_rectangular2polar(PyArrayObject *__pyx_v_rdat, PyArrayObject *__pyx_v_idat, CYTHON_UNUSED int __pyx_skip_dispatch) {
Py_ssize_t __pyx_v_size;
__Pyx_memviewslice __pyx_v_rdat_view = { 0, 0, { 0 }, { 0 }, { 0 } };
__Pyx_memviewslice __pyx_v_idat_view = { 0, 0, { 0 }, { 0 }, { 0 } };
CYTHON_UNUSED PyObject *__pyx_v_res = NULL;
PyArrayObject *__pyx_r = NULL;
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__PYX_XCLEAR_MEMVIEW(&__pyx_t_3, 1);
__Pyx_AddTraceback("pysndlib.clm.mus_rectangular2polar", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__PYX_XCLEAR_MEMVIEW(&__pyx_v_rdat_view, 1);
__PYX_XCLEAR_MEMVIEW(&__pyx_v_idat_view, 1);
__Pyx_XDECREF(__pyx_v_res);
__Pyx_XGIVEREF((PyObject *)__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_93mus_rectangular2polar(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_92mus_rectangular2polar, "\n in-place operation. convert real/imaginary data in s rl and im from rectangular form (fft output) to polar form (a\n spectrum).\n \n :param rdat: real data\n :param imaginary: imaginary data\n :return: magnitude written into rdat, idat contains phases\n :rtype: np.ndarray\n \n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_93mus_rectangular2polar = {"mus_rectangular2polar", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_93mus_rectangular2polar, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_92mus_rectangular2polar};
static PyObject *__pyx_pw_8pysndlib_3clm_93mus_rectangular2polar(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
PyArrayObject *__pyx_v_rdat = 0;
PyArrayObject *__pyx_v_idat = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("mus_rectangular2polar (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_rdat,&__pyx_n_s_idat,0};
PyObject* values[2] = {0,0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_rdat)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1428, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_idat)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1428, __pyx_L3_error)
else {
__Pyx_RaiseArgtupleInvalid("mus_rectangular2polar", 1, 2, 2, 1); __PYX_ERR(0, 1428, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "mus_rectangular2polar") < 0)) __PYX_ERR(0, 1428, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 2)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
}
__pyx_v_rdat = ((PyArrayObject *)values[0]);
__pyx_v_idat = ((PyArrayObject *)values[1]);
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("mus_rectangular2polar", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 1428, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.mus_rectangular2polar", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_rdat), __pyx_ptype_5numpy_ndarray, 1, "rdat", 0))) __PYX_ERR(0, 1428, __pyx_L1_error)
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_idat), __pyx_ptype_5numpy_ndarray, 1, "idat", 0))) __PYX_ERR(0, 1428, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_92mus_rectangular2polar(__pyx_self, __pyx_v_rdat, __pyx_v_idat);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_92mus_rectangular2polar(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_rdat, PyArrayObject *__pyx_v_idat) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = ((PyObject *)__pyx_f_8pysndlib_3clm_mus_rectangular2polar(__pyx_v_rdat, __pyx_v_idat, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1428, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("pysndlib.clm.mus_rectangular2polar", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_tuple__224 = PyTuple_Pack(2, __pyx_n_s_rdat, __pyx_n_s_idat); if (unlikely(!__pyx_tuple__224)) __PYX_ERR(0, 1428, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__224);
__Pyx_GIVEREF(__pyx_tuple__224);
/* … */
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_93mus_rectangular2polar, 0, __pyx_n_s_mus_rectangular2polar, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__225)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 1428, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_mus_rectangular2polar, __pyx_t_40) < 0) __PYX_ERR(0, 1428, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
__pyx_codeobj__225 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__224, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_mus_rectangular2polar, 1428, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__225)) __PYX_ERR(0, 1428, __pyx_L1_error)
1429: """
1430: in-place operation. convert real/imaginary data in s rl and im from rectangular form (fft output) to polar form (a
1431: spectrum).
1432:
1433: :param rdat: real data
1434: :param imaginary: imaginary data
1435: :return: magnitude written into rdat, idat contains phases
1436: :rtype: np.ndarray
1437:
1438: """
+1439: size = len(rdat)
__pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_rdat)); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1439, __pyx_L1_error) __pyx_v_size = __pyx_t_1;
1440:
+1441: check_ndim(rdat)
__pyx_t_2 = __pyx_f_8pysndlib_3clm_check_ndim(((PyObject *)__pyx_v_rdat), 0, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1441, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+1442: check_ndim(idat)
__pyx_t_2 = __pyx_f_8pysndlib_3clm_check_ndim(((PyObject *)__pyx_v_idat), 0, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1442, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+1443: compare_shapes(rdat, idat)
__pyx_t_2 = __pyx_f_8pysndlib_3clm_compare_shapes(((PyObject *)__pyx_v_rdat), ((PyObject *)__pyx_v_idat), 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1443, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
1444:
+1445: cdef double [:] rdat_view = rdat
__pyx_t_3 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(((PyObject *)__pyx_v_rdat), PyBUF_WRITABLE); if (unlikely(!__pyx_t_3.memview)) __PYX_ERR(0, 1445, __pyx_L1_error) __pyx_v_rdat_view = __pyx_t_3; __pyx_t_3.memview = NULL; __pyx_t_3.data = NULL;
+1446: cdef double [:] idat_view = idat
__pyx_t_3 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(((PyObject *)__pyx_v_idat), PyBUF_WRITABLE); if (unlikely(!__pyx_t_3.memview)) __PYX_ERR(0, 1446, __pyx_L1_error) __pyx_v_idat_view = __pyx_t_3; __pyx_t_3.memview = NULL; __pyx_t_3.data = NULL;
+1447: res = cclm.mus_rectangular_to_polar(&rdat_view[0], &idat_view[0], size)
__pyx_t_4 = 0;
__pyx_t_5 = -1;
if (__pyx_t_4 < 0) {
__pyx_t_4 += __pyx_v_rdat_view.shape[0];
if (unlikely(__pyx_t_4 < 0)) __pyx_t_5 = 0;
} else if (unlikely(__pyx_t_4 >= __pyx_v_rdat_view.shape[0])) __pyx_t_5 = 0;
if (unlikely(__pyx_t_5 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_5);
__PYX_ERR(0, 1447, __pyx_L1_error)
}
__pyx_t_6 = 0;
__pyx_t_5 = -1;
if (__pyx_t_6 < 0) {
__pyx_t_6 += __pyx_v_idat_view.shape[0];
if (unlikely(__pyx_t_6 < 0)) __pyx_t_5 = 0;
} else if (unlikely(__pyx_t_6 >= __pyx_v_idat_view.shape[0])) __pyx_t_5 = 0;
if (unlikely(__pyx_t_5 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_5);
__PYX_ERR(0, 1447, __pyx_L1_error)
}
__pyx_t_2 = __Pyx_void_to_None(mus_rectangular_to_polar((&(*((double *) ( /* dim=0 */ (__pyx_v_rdat_view.data + __pyx_t_4 * __pyx_v_rdat_view.strides[0]) )))), (&(*((double *) ( /* dim=0 */ (__pyx_v_idat_view.data + __pyx_t_6 * __pyx_v_idat_view.strides[0]) )))), __pyx_v_size)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1447, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_v_res = __pyx_t_2;
__pyx_t_2 = 0;
+1448: return rdat
__Pyx_XDECREF((PyObject *)__pyx_r); __Pyx_INCREF((PyObject *)__pyx_v_rdat); __pyx_r = __pyx_v_rdat; goto __pyx_L0;
1449:
+1450: def rectangular2polar(rdat: npt.NDArray[np.float64], idat: npt.NDArray[np.float64]):
/* Python wrapper */ static PyObject *__pyx_pw_8pysndlib_3clm_95rectangular2polar(PyObject *__pyx_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_94rectangular2polar, "\n convert real/imaginary data in rdat and idat from rectangular form (fft output) to polar form (a\n spectrum).\n \n :param rdat: real data\n :param imaginary: imaginary data\n :return::return: tuple of magnitude and phases\n :rtype: tuple\n \n "); static PyMethodDef __pyx_mdef_8pysndlib_3clm_95rectangular2polar = {"rectangular2polar", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_95rectangular2polar, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_94rectangular2polar}; static PyObject *__pyx_pw_8pysndlib_3clm_95rectangular2polar(PyObject *__pyx_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { PyObject *__pyx_v_rdat = 0; PyObject *__pyx_v_idat = 0; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("rectangular2polar (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_MACROS __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { PyObject **__pyx_pyargnames[] = {&__pyx_n_s_rdat,&__pyx_n_s_idat,0}; PyObject* values[2] = {0,0}; if (__pyx_kwds) { Py_ssize_t kw_args; switch (__pyx_nargs) { case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); CYTHON_FALLTHROUGH; case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); switch (__pyx_nargs) { case 0: if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_rdat)) != 0)) { (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); kw_args--; } else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1450, __pyx_L3_error) else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_idat)) != 0)) { (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); kw_args--; } else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1450, __pyx_L3_error) else { __Pyx_RaiseArgtupleInvalid("rectangular2polar", 1, 2, 2, 1); __PYX_ERR(0, 1450, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { const Py_ssize_t kwd_pos_args = __pyx_nargs; if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "rectangular2polar") < 0)) __PYX_ERR(0, 1450, __pyx_L3_error) } } else if (unlikely(__pyx_nargs != 2)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); } __pyx_v_rdat = values[0]; __pyx_v_idat = values[1]; } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("rectangular2polar", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 1450, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; { Py_ssize_t __pyx_temp; for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); } } __Pyx_AddTraceback("pysndlib.clm.rectangular2polar", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_8pysndlib_3clm_94rectangular2polar(__pyx_self, __pyx_v_rdat, __pyx_v_idat); int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; /* function exit code */ { Py_ssize_t __pyx_temp; for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); } } __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_8pysndlib_3clm_94rectangular2polar(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_rdat, PyObject *__pyx_v_idat) { Py_ssize_t __pyx_v_size; PyObject *__pyx_v_rdat_cpy = NULL; PyObject *__pyx_v_idat_cpy = NULL; __Pyx_memviewslice __pyx_v_rdat_view = { 0, 0, { 0 }, { 0 }, { 0 } }; __Pyx_memviewslice __pyx_v_idat_view = { 0, 0, { 0 }, { 0 }, { 0 } }; CYTHON_UNUSED PyObject *__pyx_v_res = NULL; PyObject *__pyx_r = NULL; /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __PYX_XCLEAR_MEMVIEW(&__pyx_t_6, 1); __Pyx_AddTraceback("pysndlib.clm.rectangular2polar", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_rdat_cpy); __Pyx_XDECREF(__pyx_v_idat_cpy); __PYX_XCLEAR_MEMVIEW(&__pyx_v_rdat_view, 1); __PYX_XCLEAR_MEMVIEW(&__pyx_v_idat_view, 1); __Pyx_XDECREF(__pyx_v_res); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__226 = PyTuple_Pack(8, __pyx_n_s_rdat, __pyx_n_s_idat, __pyx_n_s_size, __pyx_n_s_rdat_cpy, __pyx_n_s_idat_cpy, __pyx_n_s_rdat_view, __pyx_n_s_idat_view, __pyx_n_s_res); if (unlikely(!__pyx_tuple__226)) __PYX_ERR(0, 1450, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__226); __Pyx_GIVEREF(__pyx_tuple__226); /* … */ __pyx_t_40 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 1450, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_40); if (PyDict_SetItem(__pyx_t_40, __pyx_n_s_rdat, __pyx_kp_s_npt_NDArray_np_float64) < 0) __PYX_ERR(0, 1450, __pyx_L1_error) if (PyDict_SetItem(__pyx_t_40, __pyx_n_s_idat, __pyx_kp_s_npt_NDArray_np_float64) < 0) __PYX_ERR(0, 1450, __pyx_L1_error) __pyx_t_43 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_95rectangular2polar, 0, __pyx_n_s_rectangular2polar, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__227)); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 1450, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_43); __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_43, __pyx_t_40); __Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0; if (PyDict_SetItem(__pyx_d, __pyx_n_s_rectangular2polar, __pyx_t_43) < 0) __PYX_ERR(0, 1450, __pyx_L1_error) __Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0; __pyx_codeobj__227 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 8, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__226, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_rectangular2polar, 1450, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__227)) __PYX_ERR(0, 1450, __pyx_L1_error)
1451: """
1452: convert real/imaginary data in rdat and idat from rectangular form (fft output) to polar form (a
1453: spectrum).
1454:
1455: :param rdat: real data
1456: :param imaginary: imaginary data
1457: :return::return: tuple of magnitude and phases
1458: :rtype: tuple
1459:
1460: """
+1461: size = len(rdat)
__pyx_t_1 = PyObject_Length(__pyx_v_rdat); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1461, __pyx_L1_error) __pyx_v_size = __pyx_t_1;
1462:
+1463: check_ndim(rdat)
__pyx_t_2 = __pyx_f_8pysndlib_3clm_check_ndim(__pyx_v_rdat, 0, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1463, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+1464: check_ndim(idat)
__pyx_t_2 = __pyx_f_8pysndlib_3clm_check_ndim(__pyx_v_idat, 0, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1464, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+1465: compare_shapes(rdat, idat)
__pyx_t_2 = __pyx_f_8pysndlib_3clm_compare_shapes(__pyx_v_rdat, __pyx_v_idat, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1465, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
1466:
+1467: rdat_cpy = np.copy(rdat)
__Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1467, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_copy); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1467, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = NULL; __pyx_t_5 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_4))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_4, function); __pyx_t_5 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v_rdat}; __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1467, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } __pyx_v_rdat_cpy = __pyx_t_2; __pyx_t_2 = 0;
+1468: idat_cpy = np.copy(idat)
__Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1468, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_copy); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1468, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = NULL; __pyx_t_5 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_3))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); __pyx_t_5 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v_idat}; __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1468, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } __pyx_v_idat_cpy = __pyx_t_2; __pyx_t_2 = 0;
1469:
+1470: cdef double [:] rdat_view = rdat_cpy
__pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_v_rdat_cpy, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 1470, __pyx_L1_error) __pyx_v_rdat_view = __pyx_t_6; __pyx_t_6.memview = NULL; __pyx_t_6.data = NULL;
+1471: cdef double [:] idat_view = idat_cpy
__pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_v_idat_cpy, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 1471, __pyx_L1_error) __pyx_v_idat_view = __pyx_t_6; __pyx_t_6.memview = NULL; __pyx_t_6.data = NULL;
+1472: res = cclm.mus_rectangular_to_polar(&rdat_view[0], &idat_view[0], size)
__pyx_t_7 = 0;
__pyx_t_5 = -1;
if (__pyx_t_7 < 0) {
__pyx_t_7 += __pyx_v_rdat_view.shape[0];
if (unlikely(__pyx_t_7 < 0)) __pyx_t_5 = 0;
} else if (unlikely(__pyx_t_7 >= __pyx_v_rdat_view.shape[0])) __pyx_t_5 = 0;
if (unlikely(__pyx_t_5 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_5);
__PYX_ERR(0, 1472, __pyx_L1_error)
}
__pyx_t_8 = 0;
__pyx_t_5 = -1;
if (__pyx_t_8 < 0) {
__pyx_t_8 += __pyx_v_idat_view.shape[0];
if (unlikely(__pyx_t_8 < 0)) __pyx_t_5 = 0;
} else if (unlikely(__pyx_t_8 >= __pyx_v_idat_view.shape[0])) __pyx_t_5 = 0;
if (unlikely(__pyx_t_5 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_5);
__PYX_ERR(0, 1472, __pyx_L1_error)
}
__pyx_t_2 = __Pyx_void_to_None(mus_rectangular_to_polar((&(*((double *) ( /* dim=0 */ (__pyx_v_rdat_view.data + __pyx_t_7 * __pyx_v_rdat_view.strides[0]) )))), (&(*((double *) ( /* dim=0 */ (__pyx_v_idat_view.data + __pyx_t_8 * __pyx_v_idat_view.strides[0]) )))), __pyx_v_size)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1472, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_v_res = __pyx_t_2;
__pyx_t_2 = 0;
+1473: return rdat_cpy, idat_cpy
__Pyx_XDECREF(__pyx_r); __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1473, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_v_rdat_cpy); __Pyx_GIVEREF(__pyx_v_rdat_cpy); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_rdat_cpy)) __PYX_ERR(0, 1473, __pyx_L1_error); __Pyx_INCREF(__pyx_v_idat_cpy); __Pyx_GIVEREF(__pyx_v_idat_cpy); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_idat_cpy)) __PYX_ERR(0, 1473, __pyx_L1_error); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0;
1474:
+1475: cpdef np.ndarray mus_rectangular2magnitudes(np.ndarray rdat, np.ndarray idat):
static PyObject *__pyx_pw_8pysndlib_3clm_97mus_rectangular2magnitudes(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyArrayObject *__pyx_f_8pysndlib_3clm_mus_rectangular2magnitudes(PyArrayObject *__pyx_v_rdat, PyArrayObject *__pyx_v_idat, CYTHON_UNUSED int __pyx_skip_dispatch) {
Py_ssize_t __pyx_v_size;
__Pyx_memviewslice __pyx_v_rdat_view = { 0, 0, { 0 }, { 0 }, { 0 } };
__Pyx_memviewslice __pyx_v_idat_view = { 0, 0, { 0 }, { 0 }, { 0 } };
PyArrayObject *__pyx_r = NULL;
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__PYX_XCLEAR_MEMVIEW(&__pyx_t_3, 1);
__Pyx_AddTraceback("pysndlib.clm.mus_rectangular2magnitudes", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__PYX_XCLEAR_MEMVIEW(&__pyx_v_rdat_view, 1);
__PYX_XCLEAR_MEMVIEW(&__pyx_v_idat_view, 1);
__Pyx_XGIVEREF((PyObject *)__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_97mus_rectangular2magnitudes(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_96mus_rectangular2magnitudes, "\n in-place operation. convert real/imaginary data in rl and im from rectangular form (fft output) to polar form, but\n ignore the phases.\n \n :param rdat: real data\n :param imaginary: imaginary data\n :return: magnitude written into rdat\n :rtype: np.ndarray\n \n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_97mus_rectangular2magnitudes = {"mus_rectangular2magnitudes", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_97mus_rectangular2magnitudes, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_96mus_rectangular2magnitudes};
static PyObject *__pyx_pw_8pysndlib_3clm_97mus_rectangular2magnitudes(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
PyArrayObject *__pyx_v_rdat = 0;
PyArrayObject *__pyx_v_idat = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("mus_rectangular2magnitudes (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_rdat,&__pyx_n_s_idat,0};
PyObject* values[2] = {0,0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_rdat)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1475, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_idat)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1475, __pyx_L3_error)
else {
__Pyx_RaiseArgtupleInvalid("mus_rectangular2magnitudes", 1, 2, 2, 1); __PYX_ERR(0, 1475, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "mus_rectangular2magnitudes") < 0)) __PYX_ERR(0, 1475, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 2)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
}
__pyx_v_rdat = ((PyArrayObject *)values[0]);
__pyx_v_idat = ((PyArrayObject *)values[1]);
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("mus_rectangular2magnitudes", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 1475, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.mus_rectangular2magnitudes", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_rdat), __pyx_ptype_5numpy_ndarray, 1, "rdat", 0))) __PYX_ERR(0, 1475, __pyx_L1_error)
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_idat), __pyx_ptype_5numpy_ndarray, 1, "idat", 0))) __PYX_ERR(0, 1475, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_96mus_rectangular2magnitudes(__pyx_self, __pyx_v_rdat, __pyx_v_idat);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_96mus_rectangular2magnitudes(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_rdat, PyArrayObject *__pyx_v_idat) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = ((PyObject *)__pyx_f_8pysndlib_3clm_mus_rectangular2magnitudes(__pyx_v_rdat, __pyx_v_idat, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1475, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("pysndlib.clm.mus_rectangular2magnitudes", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_43 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_97mus_rectangular2magnitudes, 0, __pyx_n_s_mus_rectangular2magnitudes, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__228)); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 1475, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_mus_rectangular2magnitudes, __pyx_t_43) < 0) __PYX_ERR(0, 1475, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
/* … */
__pyx_codeobj__228 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__224, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_mus_rectangular2magnitudes, 1475, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__228)) __PYX_ERR(0, 1475, __pyx_L1_error)
1476: """
1477: in-place operation. convert real/imaginary data in rl and im from rectangular form (fft output) to polar form, but
1478: ignore the phases.
1479:
1480: :param rdat: real data
1481: :param imaginary: imaginary data
1482: :return: magnitude written into rdat
1483: :rtype: np.ndarray
1484:
1485: """
+1486: size = len(rdat)
__pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_rdat)); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1486, __pyx_L1_error) __pyx_v_size = __pyx_t_1;
+1487: compare_shapes(rdat, idat)
__pyx_t_2 = __pyx_f_8pysndlib_3clm_compare_shapes(((PyObject *)__pyx_v_rdat), ((PyObject *)__pyx_v_idat), 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1487, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+1488: cdef double [:] rdat_view = rdat
__pyx_t_3 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(((PyObject *)__pyx_v_rdat), PyBUF_WRITABLE); if (unlikely(!__pyx_t_3.memview)) __PYX_ERR(0, 1488, __pyx_L1_error) __pyx_v_rdat_view = __pyx_t_3; __pyx_t_3.memview = NULL; __pyx_t_3.data = NULL;
+1489: cdef double [:] idat_view = idat
__pyx_t_3 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(((PyObject *)__pyx_v_idat), PyBUF_WRITABLE); if (unlikely(!__pyx_t_3.memview)) __PYX_ERR(0, 1489, __pyx_L1_error) __pyx_v_idat_view = __pyx_t_3; __pyx_t_3.memview = NULL; __pyx_t_3.data = NULL;
1490:
1491:
+1492: cclm.mus_rectangular_to_magnitudes(&rdat_view[0], &idat_view[0], size)
__pyx_t_4 = 0;
__pyx_t_5 = -1;
if (__pyx_t_4 < 0) {
__pyx_t_4 += __pyx_v_rdat_view.shape[0];
if (unlikely(__pyx_t_4 < 0)) __pyx_t_5 = 0;
} else if (unlikely(__pyx_t_4 >= __pyx_v_rdat_view.shape[0])) __pyx_t_5 = 0;
if (unlikely(__pyx_t_5 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_5);
__PYX_ERR(0, 1492, __pyx_L1_error)
}
__pyx_t_6 = 0;
__pyx_t_5 = -1;
if (__pyx_t_6 < 0) {
__pyx_t_6 += __pyx_v_idat_view.shape[0];
if (unlikely(__pyx_t_6 < 0)) __pyx_t_5 = 0;
} else if (unlikely(__pyx_t_6 >= __pyx_v_idat_view.shape[0])) __pyx_t_5 = 0;
if (unlikely(__pyx_t_5 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_5);
__PYX_ERR(0, 1492, __pyx_L1_error)
}
mus_rectangular_to_magnitudes((&(*((double *) ( /* dim=0 */ (__pyx_v_rdat_view.data + __pyx_t_4 * __pyx_v_rdat_view.strides[0]) )))), (&(*((double *) ( /* dim=0 */ (__pyx_v_idat_view.data + __pyx_t_6 * __pyx_v_idat_view.strides[0]) )))), __pyx_v_size);
+1493: return rdat
__Pyx_XDECREF((PyObject *)__pyx_r); __Pyx_INCREF((PyObject *)__pyx_v_rdat); __pyx_r = __pyx_v_rdat; goto __pyx_L0;
1494:
+1495: def rectangular2magnitudes(rdat: npt.NDArray[np.float64], idat: npt.NDArray[np.float64]):
/* Python wrapper */ static PyObject *__pyx_pw_8pysndlib_3clm_99rectangular2magnitudes(PyObject *__pyx_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_98rectangular2magnitudes, "\n convert real/imaginary data in rl and im from rectangular form (fft output) to polar form, but\n ignore the phases.\n \n :param rdat: real data\n :param imaginary: imaginary data\n :return: magnitude\n :rtype: np.ndarray\n \n "); static PyMethodDef __pyx_mdef_8pysndlib_3clm_99rectangular2magnitudes = {"rectangular2magnitudes", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_99rectangular2magnitudes, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_98rectangular2magnitudes}; static PyObject *__pyx_pw_8pysndlib_3clm_99rectangular2magnitudes(PyObject *__pyx_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { PyObject *__pyx_v_rdat = 0; PyObject *__pyx_v_idat = 0; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("rectangular2magnitudes (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_MACROS __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { PyObject **__pyx_pyargnames[] = {&__pyx_n_s_rdat,&__pyx_n_s_idat,0}; PyObject* values[2] = {0,0}; if (__pyx_kwds) { Py_ssize_t kw_args; switch (__pyx_nargs) { case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); CYTHON_FALLTHROUGH; case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); switch (__pyx_nargs) { case 0: if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_rdat)) != 0)) { (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); kw_args--; } else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1495, __pyx_L3_error) else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_idat)) != 0)) { (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); kw_args--; } else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1495, __pyx_L3_error) else { __Pyx_RaiseArgtupleInvalid("rectangular2magnitudes", 1, 2, 2, 1); __PYX_ERR(0, 1495, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { const Py_ssize_t kwd_pos_args = __pyx_nargs; if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "rectangular2magnitudes") < 0)) __PYX_ERR(0, 1495, __pyx_L3_error) } } else if (unlikely(__pyx_nargs != 2)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); } __pyx_v_rdat = values[0]; __pyx_v_idat = values[1]; } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("rectangular2magnitudes", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 1495, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; { Py_ssize_t __pyx_temp; for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); } } __Pyx_AddTraceback("pysndlib.clm.rectangular2magnitudes", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_8pysndlib_3clm_98rectangular2magnitudes(__pyx_self, __pyx_v_rdat, __pyx_v_idat); int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; /* function exit code */ { Py_ssize_t __pyx_temp; for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); } } __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_8pysndlib_3clm_98rectangular2magnitudes(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_rdat, PyObject *__pyx_v_idat) { Py_ssize_t __pyx_v_size; PyObject *__pyx_v_rdat_cpy = NULL; PyObject *__pyx_v_idat_cpy = NULL; __Pyx_memviewslice __pyx_v_rdat_view = { 0, 0, { 0 }, { 0 }, { 0 } }; __Pyx_memviewslice __pyx_v_idat_view = { 0, 0, { 0 }, { 0 }, { 0 } }; PyObject *__pyx_r = NULL; /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __PYX_XCLEAR_MEMVIEW(&__pyx_t_6, 1); __Pyx_AddTraceback("pysndlib.clm.rectangular2magnitudes", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_rdat_cpy); __Pyx_XDECREF(__pyx_v_idat_cpy); __PYX_XCLEAR_MEMVIEW(&__pyx_v_rdat_view, 1); __PYX_XCLEAR_MEMVIEW(&__pyx_v_idat_view, 1); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__229 = PyTuple_Pack(7, __pyx_n_s_rdat, __pyx_n_s_idat, __pyx_n_s_size, __pyx_n_s_rdat_cpy, __pyx_n_s_idat_cpy, __pyx_n_s_rdat_view, __pyx_n_s_idat_view); if (unlikely(!__pyx_tuple__229)) __PYX_ERR(0, 1495, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__229); __Pyx_GIVEREF(__pyx_tuple__229); /* … */ __pyx_t_43 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 1495, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_43); if (PyDict_SetItem(__pyx_t_43, __pyx_n_s_rdat, __pyx_kp_s_npt_NDArray_np_float64) < 0) __PYX_ERR(0, 1495, __pyx_L1_error) if (PyDict_SetItem(__pyx_t_43, __pyx_n_s_idat, __pyx_kp_s_npt_NDArray_np_float64) < 0) __PYX_ERR(0, 1495, __pyx_L1_error) __pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_99rectangular2magnitudes, 0, __pyx_n_s_rectangular2magnitudes, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__230)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 1495, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_40); __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_40, __pyx_t_43); __Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0; if (PyDict_SetItem(__pyx_d, __pyx_n_s_rectangular2magnitudes, __pyx_t_40) < 0) __PYX_ERR(0, 1495, __pyx_L1_error) __Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0; __pyx_codeobj__230 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 7, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__229, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_rectangular2magnitudes, 1495, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__230)) __PYX_ERR(0, 1495, __pyx_L1_error)
1496: """
1497: convert real/imaginary data in rl and im from rectangular form (fft output) to polar form, but
1498: ignore the phases.
1499:
1500: :param rdat: real data
1501: :param imaginary: imaginary data
1502: :return: magnitude
1503: :rtype: np.ndarray
1504:
1505: """
+1506: size = len(rdat)
__pyx_t_1 = PyObject_Length(__pyx_v_rdat); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1506, __pyx_L1_error) __pyx_v_size = __pyx_t_1;
+1507: compare_shapes(rdat, idat)
__pyx_t_2 = __pyx_f_8pysndlib_3clm_compare_shapes(__pyx_v_rdat, __pyx_v_idat, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1507, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+1508: rdat_cpy = np.copy(rdat)
__Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1508, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_copy); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1508, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = NULL; __pyx_t_5 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_4))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_4, function); __pyx_t_5 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v_rdat}; __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1508, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } __pyx_v_rdat_cpy = __pyx_t_2; __pyx_t_2 = 0;
+1509: idat_cpy = np.copy(idat) #probably don't need to do this because idat should not be changed
__Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1509, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_copy); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1509, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = NULL; __pyx_t_5 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_3))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); __pyx_t_5 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v_idat}; __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1509, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } __pyx_v_idat_cpy = __pyx_t_2; __pyx_t_2 = 0;
1510:
+1511: cdef double [:] rdat_view = rdat_cpy
__pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_v_rdat_cpy, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 1511, __pyx_L1_error) __pyx_v_rdat_view = __pyx_t_6; __pyx_t_6.memview = NULL; __pyx_t_6.data = NULL;
+1512: cdef double [:] idat_view = idat_cpy
__pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_v_idat_cpy, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 1512, __pyx_L1_error) __pyx_v_idat_view = __pyx_t_6; __pyx_t_6.memview = NULL; __pyx_t_6.data = NULL;
1513:
1514:
+1515: cclm.mus_rectangular_to_magnitudes(&rdat_view[0], &idat_view[0], size)
__pyx_t_7 = 0;
__pyx_t_5 = -1;
if (__pyx_t_7 < 0) {
__pyx_t_7 += __pyx_v_rdat_view.shape[0];
if (unlikely(__pyx_t_7 < 0)) __pyx_t_5 = 0;
} else if (unlikely(__pyx_t_7 >= __pyx_v_rdat_view.shape[0])) __pyx_t_5 = 0;
if (unlikely(__pyx_t_5 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_5);
__PYX_ERR(0, 1515, __pyx_L1_error)
}
__pyx_t_8 = 0;
__pyx_t_5 = -1;
if (__pyx_t_8 < 0) {
__pyx_t_8 += __pyx_v_idat_view.shape[0];
if (unlikely(__pyx_t_8 < 0)) __pyx_t_5 = 0;
} else if (unlikely(__pyx_t_8 >= __pyx_v_idat_view.shape[0])) __pyx_t_5 = 0;
if (unlikely(__pyx_t_5 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_5);
__PYX_ERR(0, 1515, __pyx_L1_error)
}
mus_rectangular_to_magnitudes((&(*((double *) ( /* dim=0 */ (__pyx_v_rdat_view.data + __pyx_t_7 * __pyx_v_rdat_view.strides[0]) )))), (&(*((double *) ( /* dim=0 */ (__pyx_v_idat_view.data + __pyx_t_8 * __pyx_v_idat_view.strides[0]) )))), __pyx_v_size);
+1516: return rdat_cpy
__Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_v_rdat_cpy); __pyx_r = __pyx_v_rdat_cpy; goto __pyx_L0;
1517:
+1518: cpdef np.ndarray mus_polar2rectangular( np.ndarray rdat, np.ndarray idat):
static PyObject *__pyx_pw_8pysndlib_3clm_101mus_polar2rectangular(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyArrayObject *__pyx_f_8pysndlib_3clm_mus_polar2rectangular(PyArrayObject *__pyx_v_rdat, PyArrayObject *__pyx_v_idat, CYTHON_UNUSED int __pyx_skip_dispatch) {
Py_ssize_t __pyx_v_size;
__Pyx_memviewslice __pyx_v_rdat_view = { 0, 0, { 0 }, { 0 }, { 0 } };
__Pyx_memviewslice __pyx_v_idat_view = { 0, 0, { 0 }, { 0 }, { 0 } };
PyArrayObject *__pyx_r = NULL;
/* … */
/* function exit code */
__pyx_L1_error:;
__PYX_XCLEAR_MEMVIEW(&__pyx_t_2, 1);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_AddTraceback("pysndlib.clm.mus_polar2rectangular", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__PYX_XCLEAR_MEMVIEW(&__pyx_v_rdat_view, 1);
__PYX_XCLEAR_MEMVIEW(&__pyx_v_idat_view, 1);
__Pyx_XGIVEREF((PyObject *)__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_101mus_polar2rectangular(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_100mus_polar2rectangular, "\n in-place operation. convert real/imaginary data in rl and im from polar (spectrum) to rectangular (fft).\n \n :param rdat: magnitude data\n :param imaginary: phases data\n :return: real data written into rdat, idat contains imaginary\n :rtype: np.ndarray\n \n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_101mus_polar2rectangular = {"mus_polar2rectangular", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_101mus_polar2rectangular, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_100mus_polar2rectangular};
static PyObject *__pyx_pw_8pysndlib_3clm_101mus_polar2rectangular(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
PyArrayObject *__pyx_v_rdat = 0;
PyArrayObject *__pyx_v_idat = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("mus_polar2rectangular (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_rdat,&__pyx_n_s_idat,0};
PyObject* values[2] = {0,0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_rdat)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1518, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_idat)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1518, __pyx_L3_error)
else {
__Pyx_RaiseArgtupleInvalid("mus_polar2rectangular", 1, 2, 2, 1); __PYX_ERR(0, 1518, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "mus_polar2rectangular") < 0)) __PYX_ERR(0, 1518, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 2)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
}
__pyx_v_rdat = ((PyArrayObject *)values[0]);
__pyx_v_idat = ((PyArrayObject *)values[1]);
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("mus_polar2rectangular", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 1518, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.mus_polar2rectangular", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_rdat), __pyx_ptype_5numpy_ndarray, 1, "rdat", 0))) __PYX_ERR(0, 1518, __pyx_L1_error)
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_idat), __pyx_ptype_5numpy_ndarray, 1, "idat", 0))) __PYX_ERR(0, 1518, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_100mus_polar2rectangular(__pyx_self, __pyx_v_rdat, __pyx_v_idat);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_100mus_polar2rectangular(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_rdat, PyArrayObject *__pyx_v_idat) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = ((PyObject *)__pyx_f_8pysndlib_3clm_mus_polar2rectangular(__pyx_v_rdat, __pyx_v_idat, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1518, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("pysndlib.clm.mus_polar2rectangular", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_101mus_polar2rectangular, 0, __pyx_n_s_mus_polar2rectangular, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__231)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 1518, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_mus_polar2rectangular, __pyx_t_40) < 0) __PYX_ERR(0, 1518, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
/* … */
__pyx_codeobj__231 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__224, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_mus_polar2rectangular, 1518, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__231)) __PYX_ERR(0, 1518, __pyx_L1_error)
1519: """
1520: in-place operation. convert real/imaginary data in rl and im from polar (spectrum) to rectangular (fft).
1521:
1522: :param rdat: magnitude data
1523: :param imaginary: phases data
1524: :return: real data written into rdat, idat contains imaginary
1525: :rtype: np.ndarray
1526:
1527: """
+1528: size = len(rdat)
__pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_rdat)); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1528, __pyx_L1_error) __pyx_v_size = __pyx_t_1;
+1529: cdef double [:] rdat_view = rdat
__pyx_t_2 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(((PyObject *)__pyx_v_rdat), PyBUF_WRITABLE); if (unlikely(!__pyx_t_2.memview)) __PYX_ERR(0, 1529, __pyx_L1_error) __pyx_v_rdat_view = __pyx_t_2; __pyx_t_2.memview = NULL; __pyx_t_2.data = NULL;
+1530: cdef double [:] idat_view = idat
__pyx_t_2 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(((PyObject *)__pyx_v_idat), PyBUF_WRITABLE); if (unlikely(!__pyx_t_2.memview)) __PYX_ERR(0, 1530, __pyx_L1_error) __pyx_v_idat_view = __pyx_t_2; __pyx_t_2.memview = NULL; __pyx_t_2.data = NULL;
+1531: compare_shapes(rdat, idat)
__pyx_t_3 = __pyx_f_8pysndlib_3clm_compare_shapes(((PyObject *)__pyx_v_rdat), ((PyObject *)__pyx_v_idat), 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1531, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
1532:
+1533: cclm.mus_polar_to_rectangular(&rdat_view[0], &idat_view[0], size)
__pyx_t_4 = 0;
__pyx_t_5 = -1;
if (__pyx_t_4 < 0) {
__pyx_t_4 += __pyx_v_rdat_view.shape[0];
if (unlikely(__pyx_t_4 < 0)) __pyx_t_5 = 0;
} else if (unlikely(__pyx_t_4 >= __pyx_v_rdat_view.shape[0])) __pyx_t_5 = 0;
if (unlikely(__pyx_t_5 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_5);
__PYX_ERR(0, 1533, __pyx_L1_error)
}
__pyx_t_6 = 0;
__pyx_t_5 = -1;
if (__pyx_t_6 < 0) {
__pyx_t_6 += __pyx_v_idat_view.shape[0];
if (unlikely(__pyx_t_6 < 0)) __pyx_t_5 = 0;
} else if (unlikely(__pyx_t_6 >= __pyx_v_idat_view.shape[0])) __pyx_t_5 = 0;
if (unlikely(__pyx_t_5 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_5);
__PYX_ERR(0, 1533, __pyx_L1_error)
}
mus_polar_to_rectangular((&(*((double *) ( /* dim=0 */ (__pyx_v_rdat_view.data + __pyx_t_4 * __pyx_v_rdat_view.strides[0]) )))), (&(*((double *) ( /* dim=0 */ (__pyx_v_idat_view.data + __pyx_t_6 * __pyx_v_idat_view.strides[0]) )))), __pyx_v_size);
+1534: return rdat
__Pyx_XDECREF((PyObject *)__pyx_r); __Pyx_INCREF((PyObject *)__pyx_v_rdat); __pyx_r = __pyx_v_rdat; goto __pyx_L0;
1535:
1536:
+1537: def polar2rectangular(rdat: npt.NDArray[np.float64], idat: npt.NDArray[np.float64]):
/* Python wrapper */ static PyObject *__pyx_pw_8pysndlib_3clm_103polar2rectangular(PyObject *__pyx_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_102polar2rectangular, "\n in-place operation. convert real/imaginary data in rl and im from polar (spectrum) to rectangular (fft).\n \n :param rdat: magnitude data\n :param imaginary: phases data\n :return: real and imaginary\n :rtype: tuple\n \n "); static PyMethodDef __pyx_mdef_8pysndlib_3clm_103polar2rectangular = {"polar2rectangular", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_103polar2rectangular, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_102polar2rectangular}; static PyObject *__pyx_pw_8pysndlib_3clm_103polar2rectangular(PyObject *__pyx_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { PyObject *__pyx_v_rdat = 0; PyObject *__pyx_v_idat = 0; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("polar2rectangular (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_MACROS __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { PyObject **__pyx_pyargnames[] = {&__pyx_n_s_rdat,&__pyx_n_s_idat,0}; PyObject* values[2] = {0,0}; if (__pyx_kwds) { Py_ssize_t kw_args; switch (__pyx_nargs) { case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); CYTHON_FALLTHROUGH; case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); switch (__pyx_nargs) { case 0: if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_rdat)) != 0)) { (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); kw_args--; } else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1537, __pyx_L3_error) else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_idat)) != 0)) { (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); kw_args--; } else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1537, __pyx_L3_error) else { __Pyx_RaiseArgtupleInvalid("polar2rectangular", 1, 2, 2, 1); __PYX_ERR(0, 1537, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { const Py_ssize_t kwd_pos_args = __pyx_nargs; if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "polar2rectangular") < 0)) __PYX_ERR(0, 1537, __pyx_L3_error) } } else if (unlikely(__pyx_nargs != 2)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); } __pyx_v_rdat = values[0]; __pyx_v_idat = values[1]; } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("polar2rectangular", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 1537, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; { Py_ssize_t __pyx_temp; for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); } } __Pyx_AddTraceback("pysndlib.clm.polar2rectangular", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_8pysndlib_3clm_102polar2rectangular(__pyx_self, __pyx_v_rdat, __pyx_v_idat); int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; /* function exit code */ { Py_ssize_t __pyx_temp; for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); } } __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_8pysndlib_3clm_102polar2rectangular(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_rdat, PyObject *__pyx_v_idat) { Py_ssize_t __pyx_v_size; PyObject *__pyx_v_rdat_cpy = NULL; PyObject *__pyx_v_idat_cpy = NULL; __Pyx_memviewslice __pyx_v_rdat_view = { 0, 0, { 0 }, { 0 }, { 0 } }; __Pyx_memviewslice __pyx_v_idat_view = { 0, 0, { 0 }, { 0 }, { 0 } }; PyObject *__pyx_r = NULL; /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __PYX_XCLEAR_MEMVIEW(&__pyx_t_6, 1); __Pyx_AddTraceback("pysndlib.clm.polar2rectangular", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_rdat_cpy); __Pyx_XDECREF(__pyx_v_idat_cpy); __PYX_XCLEAR_MEMVIEW(&__pyx_v_rdat_view, 1); __PYX_XCLEAR_MEMVIEW(&__pyx_v_idat_view, 1); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_t_40 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 1537, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_40); if (PyDict_SetItem(__pyx_t_40, __pyx_n_s_rdat, __pyx_kp_s_npt_NDArray_np_float64) < 0) __PYX_ERR(0, 1537, __pyx_L1_error) if (PyDict_SetItem(__pyx_t_40, __pyx_n_s_idat, __pyx_kp_s_npt_NDArray_np_float64) < 0) __PYX_ERR(0, 1537, __pyx_L1_error) __pyx_t_43 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_103polar2rectangular, 0, __pyx_n_s_polar2rectangular, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__232)); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 1537, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_43); __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_43, __pyx_t_40); __Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0; if (PyDict_SetItem(__pyx_d, __pyx_n_s_polar2rectangular, __pyx_t_43) < 0) __PYX_ERR(0, 1537, __pyx_L1_error) __Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0; /* … */ __pyx_codeobj__232 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 7, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__229, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_polar2rectangular, 1537, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__232)) __PYX_ERR(0, 1537, __pyx_L1_error)
1538: """
1539: in-place operation. convert real/imaginary data in rl and im from polar (spectrum) to rectangular (fft).
1540:
1541: :param rdat: magnitude data
1542: :param imaginary: phases data
1543: :return: real and imaginary
1544: :rtype: tuple
1545:
1546: """
+1547: size = len(rdat)
__pyx_t_1 = PyObject_Length(__pyx_v_rdat); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1547, __pyx_L1_error) __pyx_v_size = __pyx_t_1;
+1548: compare_shapes(rdat, idat)
__pyx_t_2 = __pyx_f_8pysndlib_3clm_compare_shapes(__pyx_v_rdat, __pyx_v_idat, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1548, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
1549:
1550:
+1551: rdat_cpy = np.copy(rdat)
__Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1551, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_copy); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1551, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = NULL; __pyx_t_5 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_4))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_4, function); __pyx_t_5 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v_rdat}; __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1551, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } __pyx_v_rdat_cpy = __pyx_t_2; __pyx_t_2 = 0;
+1552: idat_cpy = np.copy(idat) #probably don't need to do this because idat should not be changed
__Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1552, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_copy); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1552, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = NULL; __pyx_t_5 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_3))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); __pyx_t_5 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v_idat}; __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1552, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } __pyx_v_idat_cpy = __pyx_t_2; __pyx_t_2 = 0;
+1553: cdef double [:] rdat_view = rdat_cpy
__pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_v_rdat_cpy, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 1553, __pyx_L1_error) __pyx_v_rdat_view = __pyx_t_6; __pyx_t_6.memview = NULL; __pyx_t_6.data = NULL;
+1554: cdef double [:] idat_view = idat_cpy
__pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_v_idat_cpy, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 1554, __pyx_L1_error) __pyx_v_idat_view = __pyx_t_6; __pyx_t_6.memview = NULL; __pyx_t_6.data = NULL;
1555:
+1556: cclm.mus_polar_to_rectangular(&rdat_view[0], &idat_view[0], size)
__pyx_t_7 = 0;
__pyx_t_5 = -1;
if (__pyx_t_7 < 0) {
__pyx_t_7 += __pyx_v_rdat_view.shape[0];
if (unlikely(__pyx_t_7 < 0)) __pyx_t_5 = 0;
} else if (unlikely(__pyx_t_7 >= __pyx_v_rdat_view.shape[0])) __pyx_t_5 = 0;
if (unlikely(__pyx_t_5 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_5);
__PYX_ERR(0, 1556, __pyx_L1_error)
}
__pyx_t_8 = 0;
__pyx_t_5 = -1;
if (__pyx_t_8 < 0) {
__pyx_t_8 += __pyx_v_idat_view.shape[0];
if (unlikely(__pyx_t_8 < 0)) __pyx_t_5 = 0;
} else if (unlikely(__pyx_t_8 >= __pyx_v_idat_view.shape[0])) __pyx_t_5 = 0;
if (unlikely(__pyx_t_5 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_5);
__PYX_ERR(0, 1556, __pyx_L1_error)
}
mus_polar_to_rectangular((&(*((double *) ( /* dim=0 */ (__pyx_v_rdat_view.data + __pyx_t_7 * __pyx_v_rdat_view.strides[0]) )))), (&(*((double *) ( /* dim=0 */ (__pyx_v_idat_view.data + __pyx_t_8 * __pyx_v_idat_view.strides[0]) )))), __pyx_v_size);
+1557: return rdat_cpy, idat_cpy
__Pyx_XDECREF(__pyx_r); __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1557, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_v_rdat_cpy); __Pyx_GIVEREF(__pyx_v_rdat_cpy); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_rdat_cpy)) __PYX_ERR(0, 1557, __pyx_L1_error); __Pyx_INCREF(__pyx_v_idat_cpy); __Pyx_GIVEREF(__pyx_v_idat_cpy); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_idat_cpy)) __PYX_ERR(0, 1557, __pyx_L1_error); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0;
1558:
1559:
+1560: cpdef np.ndarray mus_spectrum(np.ndarray rdat, np.ndarray idat, np.ndarray window, Spectrum norm_type= Spectrum.IN_DB):
static PyObject *__pyx_pw_8pysndlib_3clm_105mus_spectrum(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyArrayObject *__pyx_f_8pysndlib_3clm_mus_spectrum(PyArrayObject *__pyx_v_rdat, PyArrayObject *__pyx_v_idat, PyArrayObject *__pyx_v_window, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_8pysndlib_3clm_mus_spectrum *__pyx_optional_args) {
enum __pyx_t_8pysndlib_3clm_Spectrum __pyx_v_norm_type = __pyx_k__28;
Py_ssize_t __pyx_v_size;
__Pyx_memviewslice __pyx_v_rdat_view = { 0, 0, { 0 }, { 0 }, { 0 } };
__Pyx_memviewslice __pyx_v_idat_view = { 0, 0, { 0 }, { 0 }, { 0 } };
__Pyx_memviewslice __pyx_v_window_view = { 0, 0, { 0 }, { 0 }, { 0 } };
PyArrayObject *__pyx_r = NULL;
if (__pyx_optional_args) {
if (__pyx_optional_args->__pyx_n > 0) {
__pyx_v_norm_type = __pyx_optional_args->norm_type;
}
}
__Pyx_INCREF((PyObject *)__pyx_v_window);
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_XDECREF(__pyx_t_5);
__Pyx_XDECREF(__pyx_t_6);
__PYX_XCLEAR_MEMVIEW(&__pyx_t_8, 1);
__Pyx_AddTraceback("pysndlib.clm.mus_spectrum", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__PYX_XCLEAR_MEMVIEW(&__pyx_v_rdat_view, 1);
__PYX_XCLEAR_MEMVIEW(&__pyx_v_idat_view, 1);
__PYX_XCLEAR_MEMVIEW(&__pyx_v_window_view, 1);
__Pyx_XDECREF((PyObject *)__pyx_v_window);
__Pyx_XGIVEREF((PyObject *)__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_105mus_spectrum(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_104mus_spectrum, "\n in-place operation. real and imaginary data in ndarrays rl and im, returns (in rl) the spectrum thereof; window is the\n fft data window (a ndarray as returned by make_fft_window and type determines how the spectral data is\n scaled:\n spectrum.in_db= data in db,\n spectrum.normalized (default) = linear and normalized\n spectrum.raw = linear and un-normalized.\n \n :param rdat: real data\n :param imaginary: imaginary data\n :param window: fft window\n :param norm_type: normalization type\n :return: spectrum\n :rtype: np.ndarray\n \n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_105mus_spectrum = {"mus_spectrum", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_105mus_spectrum, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_104mus_spectrum};
static PyObject *__pyx_pw_8pysndlib_3clm_105mus_spectrum(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
PyArrayObject *__pyx_v_rdat = 0;
PyArrayObject *__pyx_v_idat = 0;
PyArrayObject *__pyx_v_window = 0;
enum __pyx_t_8pysndlib_3clm_Spectrum __pyx_v_norm_type;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("mus_spectrum (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_rdat,&__pyx_n_s_idat,&__pyx_n_s_window,&__pyx_n_s_norm_type,0};
PyObject* values[4] = {0,0,0,0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
CYTHON_FALLTHROUGH;
case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_rdat)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1560, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_idat)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1560, __pyx_L3_error)
else {
__Pyx_RaiseArgtupleInvalid("mus_spectrum", 0, 3, 4, 1); __PYX_ERR(0, 1560, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 2:
if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_window)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[2]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1560, __pyx_L3_error)
else {
__Pyx_RaiseArgtupleInvalid("mus_spectrum", 0, 3, 4, 2); __PYX_ERR(0, 1560, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 3:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_norm_type);
if (value) { values[3] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1560, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "mus_spectrum") < 0)) __PYX_ERR(0, 1560, __pyx_L3_error)
}
} else {
switch (__pyx_nargs) {
case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
CYTHON_FALLTHROUGH;
case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
break;
default: goto __pyx_L5_argtuple_error;
}
}
__pyx_v_rdat = ((PyArrayObject *)values[0]);
__pyx_v_idat = ((PyArrayObject *)values[1]);
__pyx_v_window = ((PyArrayObject *)values[2]);
if (values[3]) {
__pyx_v_norm_type = ((enum __pyx_t_8pysndlib_3clm_Spectrum)__Pyx_PyInt_As_enum____pyx_t_8pysndlib_3clm_Spectrum(values[3])); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1560, __pyx_L3_error)
} else {
__pyx_v_norm_type = __pyx_k__28;
}
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("mus_spectrum", 0, 3, 4, __pyx_nargs); __PYX_ERR(0, 1560, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.mus_spectrum", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_rdat), __pyx_ptype_5numpy_ndarray, 1, "rdat", 0))) __PYX_ERR(0, 1560, __pyx_L1_error)
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_idat), __pyx_ptype_5numpy_ndarray, 1, "idat", 0))) __PYX_ERR(0, 1560, __pyx_L1_error)
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_window), __pyx_ptype_5numpy_ndarray, 1, "window", 0))) __PYX_ERR(0, 1560, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_104mus_spectrum(__pyx_self, __pyx_v_rdat, __pyx_v_idat, __pyx_v_window, __pyx_v_norm_type);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_104mus_spectrum(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_rdat, PyArrayObject *__pyx_v_idat, PyArrayObject *__pyx_v_window, enum __pyx_t_8pysndlib_3clm_Spectrum __pyx_v_norm_type) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_2.__pyx_n = 1;
__pyx_t_2.norm_type = __pyx_v_norm_type;
__pyx_t_1 = ((PyObject *)__pyx_f_8pysndlib_3clm_mus_spectrum(__pyx_v_rdat, __pyx_v_idat, __pyx_v_window, 0, &__pyx_t_2)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1560, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("pysndlib.clm.mus_spectrum", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_k__28 = __pyx_e_8pysndlib_3clm_IN_DB;
/* … */
__pyx_tuple__233 = PyTuple_Pack(4, __pyx_n_s_rdat, __pyx_n_s_idat, __pyx_n_s_window, __pyx_n_s_norm_type); if (unlikely(!__pyx_tuple__233)) __PYX_ERR(0, 1560, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__233);
__Pyx_GIVEREF(__pyx_tuple__233);
__pyx_t_43 = __Pyx_Enum_Spectrum_to_py(__pyx_e_8pysndlib_3clm_IN_DB); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 1560, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
__pyx_t_40 = PyTuple_New(1); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 1560, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
__Pyx_GIVEREF(__pyx_t_43);
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_40, 0, __pyx_t_43)) __PYX_ERR(0, 1560, __pyx_L1_error);
__pyx_t_43 = 0;
__pyx_t_43 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_105mus_spectrum, 0, __pyx_n_s_mus_spectrum, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__234)); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 1560, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
__Pyx_CyFunction_SetDefaultsTuple(__pyx_t_43, __pyx_t_40);
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
if (PyDict_SetItem(__pyx_d, __pyx_n_s_mus_spectrum, __pyx_t_43) < 0) __PYX_ERR(0, 1560, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
__pyx_codeobj__234 = (PyObject*)__Pyx_PyCode_New(4, 0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__233, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_mus_spectrum, 1560, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__234)) __PYX_ERR(0, 1560, __pyx_L1_error)
1561: """
1562: in-place operation. real and imaginary data in ndarrays rl and im, returns (in rl) the spectrum thereof; window is the
1563: fft data window (a ndarray as returned by make_fft_window and type determines how the spectral data is
1564: scaled:
1565: spectrum.in_db= data in db,
1566: spectrum.normalized (default) = linear and normalized
1567: spectrum.raw = linear and un-normalized.
1568:
1569: :param rdat: real data
1570: :param imaginary: imaginary data
1571: :param window: fft window
1572: :param norm_type: normalization type
1573: :return: spectrum
1574: :rtype: np.ndarray
1575:
1576: """
+1577: if isinstance(window, list):
__pyx_t_1 = PyList_Check(((PyObject *)__pyx_v_window));
if (__pyx_t_1) {
/* … */
}
+1578: window = np.array(window, dtype=np.double)
__Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1578, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_array); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1578, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1578, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF((PyObject *)__pyx_v_window); __Pyx_GIVEREF((PyObject *)__pyx_v_window); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_window))) __PYX_ERR(0, 1578, __pyx_L1_error); __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1578, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1578, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_double); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1578, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_dtype, __pyx_t_6) < 0) __PYX_ERR(0, 1578, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_2, __pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1578, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1578, __pyx_L1_error) __Pyx_DECREF_SET(__pyx_v_window, ((PyArrayObject *)__pyx_t_6)); __pyx_t_6 = 0;
+1579: size = len(rdat)
__pyx_t_7 = PyObject_Length(((PyObject *)__pyx_v_rdat)); if (unlikely(__pyx_t_7 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1579, __pyx_L1_error) __pyx_v_size = __pyx_t_7;
+1580: check_ndim(rdat)
__pyx_t_6 = __pyx_f_8pysndlib_3clm_check_ndim(((PyObject *)__pyx_v_rdat), 0, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1580, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+1581: check_ndim(idat)
__pyx_t_6 = __pyx_f_8pysndlib_3clm_check_ndim(((PyObject *)__pyx_v_idat), 0, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1581, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+1582: check_ndim(window)
__pyx_t_6 = __pyx_f_8pysndlib_3clm_check_ndim(((PyObject *)__pyx_v_window), 0, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1582, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+1583: compare_shapes(rdat, idat)
__pyx_t_6 = __pyx_f_8pysndlib_3clm_compare_shapes(((PyObject *)__pyx_v_rdat), ((PyObject *)__pyx_v_idat), 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1583, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
1584:
+1585: cdef double [:] rdat_view = rdat
__pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(((PyObject *)__pyx_v_rdat), PyBUF_WRITABLE); if (unlikely(!__pyx_t_8.memview)) __PYX_ERR(0, 1585, __pyx_L1_error) __pyx_v_rdat_view = __pyx_t_8; __pyx_t_8.memview = NULL; __pyx_t_8.data = NULL;
+1586: cdef double [:] idat_view = idat
__pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(((PyObject *)__pyx_v_idat), PyBUF_WRITABLE); if (unlikely(!__pyx_t_8.memview)) __PYX_ERR(0, 1586, __pyx_L1_error) __pyx_v_idat_view = __pyx_t_8; __pyx_t_8.memview = NULL; __pyx_t_8.data = NULL;
+1587: cdef double [:] window_view = window
__pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(((PyObject *)__pyx_v_window), PyBUF_WRITABLE); if (unlikely(!__pyx_t_8.memview)) __PYX_ERR(0, 1587, __pyx_L1_error) __pyx_v_window_view = __pyx_t_8; __pyx_t_8.memview = NULL; __pyx_t_8.data = NULL;
1588:
1589:
+1590: cclm.mus_spectrum(&rdat_view[0], &idat_view[0], &window_view[0], size, <cclm.mus_spectrum_t>norm_type)
__pyx_t_9 = 0;
__pyx_t_10 = -1;
if (__pyx_t_9 < 0) {
__pyx_t_9 += __pyx_v_rdat_view.shape[0];
if (unlikely(__pyx_t_9 < 0)) __pyx_t_10 = 0;
} else if (unlikely(__pyx_t_9 >= __pyx_v_rdat_view.shape[0])) __pyx_t_10 = 0;
if (unlikely(__pyx_t_10 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_10);
__PYX_ERR(0, 1590, __pyx_L1_error)
}
__pyx_t_11 = 0;
__pyx_t_10 = -1;
if (__pyx_t_11 < 0) {
__pyx_t_11 += __pyx_v_idat_view.shape[0];
if (unlikely(__pyx_t_11 < 0)) __pyx_t_10 = 0;
} else if (unlikely(__pyx_t_11 >= __pyx_v_idat_view.shape[0])) __pyx_t_10 = 0;
if (unlikely(__pyx_t_10 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_10);
__PYX_ERR(0, 1590, __pyx_L1_error)
}
__pyx_t_12 = 0;
__pyx_t_10 = -1;
if (__pyx_t_12 < 0) {
__pyx_t_12 += __pyx_v_window_view.shape[0];
if (unlikely(__pyx_t_12 < 0)) __pyx_t_10 = 0;
} else if (unlikely(__pyx_t_12 >= __pyx_v_window_view.shape[0])) __pyx_t_10 = 0;
if (unlikely(__pyx_t_10 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_10);
__PYX_ERR(0, 1590, __pyx_L1_error)
}
(void)(mus_spectrum((&(*((double *) ( /* dim=0 */ (__pyx_v_rdat_view.data + __pyx_t_9 * __pyx_v_rdat_view.strides[0]) )))), (&(*((double *) ( /* dim=0 */ (__pyx_v_idat_view.data + __pyx_t_11 * __pyx_v_idat_view.strides[0]) )))), (&(*((double *) ( /* dim=0 */ (__pyx_v_window_view.data + __pyx_t_12 * __pyx_v_window_view.strides[0]) )))), __pyx_v_size, ((mus_spectrum_t)__pyx_v_norm_type)));
+1591: return rdat
__Pyx_XDECREF((PyObject *)__pyx_r); __Pyx_INCREF((PyObject *)__pyx_v_rdat); __pyx_r = __pyx_v_rdat; goto __pyx_L0;
1592:
+1593: def spectrum(rdat: npt.NDArray[np.float64], idat: npt.NDArray[np.float64], window: npt.NDArray[np.float64], norm_type: Optional[Spectrum] = Spectrum.IN_DB):
static PyObject *__pyx_pf_8pysndlib_3clm_633__defaults__(CYTHON_UNUSED PyObject *__pyx_self) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1593, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__Pyx_INCREF(__Pyx_CyFunction_Defaults(__pyx_defaults2, __pyx_self)->__pyx_arg_norm_type);
__Pyx_GIVEREF(__Pyx_CyFunction_Defaults(__pyx_defaults2, __pyx_self)->__pyx_arg_norm_type);
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __Pyx_CyFunction_Defaults(__pyx_defaults2, __pyx_self)->__pyx_arg_norm_type)) __PYX_ERR(0, 1593, __pyx_L1_error);
__pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1593, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__Pyx_GIVEREF(__pyx_t_1);
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1)) __PYX_ERR(0, 1593, __pyx_L1_error);
__Pyx_INCREF(Py_None);
__Pyx_GIVEREF(Py_None);
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, Py_None)) __PYX_ERR(0, 1593, __pyx_L1_error);
__pyx_t_1 = 0;
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("pysndlib.clm.__defaults__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_107spectrum(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_106spectrum, "\n real and imaginary data in ndarrays rl and im, returns (in rl) the spectrum thereof; window is the\n fft data window (a ndarray as returned by make_fft_window and type determines how the spectral data is\n scaled:\n spectrum.in_db= data in db,\n spectrum.normalized (default) = linear and normalized\n spectrum.raw = linear and un-normalized.\n \n :param rdat: real data\n :param imaginary: imaginary data\n :param window: fft window\n :param norm_type: normalization type\n :return: spectrum\n :rtype: np.ndarray\n \n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_107spectrum = {"spectrum", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_107spectrum, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_106spectrum};
static PyObject *__pyx_pw_8pysndlib_3clm_107spectrum(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
PyObject *__pyx_v_rdat = 0;
PyObject *__pyx_v_idat = 0;
PyObject *__pyx_v_window = 0;
PyObject *__pyx_v_norm_type = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("spectrum (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_rdat,&__pyx_n_s_idat,&__pyx_n_s_window,&__pyx_n_s_norm_type,0};
PyObject* values[4] = {0,0,0,0};
__pyx_defaults2 *__pyx_dynamic_args = __Pyx_CyFunction_Defaults(__pyx_defaults2, __pyx_self);
values[3] = __Pyx_Arg_NewRef_FASTCALL(__pyx_dynamic_args->__pyx_arg_norm_type);
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
CYTHON_FALLTHROUGH;
case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_rdat)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1593, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_idat)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1593, __pyx_L3_error)
else {
__Pyx_RaiseArgtupleInvalid("spectrum", 0, 3, 4, 1); __PYX_ERR(0, 1593, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 2:
if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_window)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[2]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1593, __pyx_L3_error)
else {
__Pyx_RaiseArgtupleInvalid("spectrum", 0, 3, 4, 2); __PYX_ERR(0, 1593, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 3:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_norm_type);
if (value) { values[3] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1593, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "spectrum") < 0)) __PYX_ERR(0, 1593, __pyx_L3_error)
}
} else {
switch (__pyx_nargs) {
case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
CYTHON_FALLTHROUGH;
case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
break;
default: goto __pyx_L5_argtuple_error;
}
}
__pyx_v_rdat = values[0];
__pyx_v_idat = values[1];
__pyx_v_window = values[2];
__pyx_v_norm_type = values[3];
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("spectrum", 0, 3, 4, __pyx_nargs); __PYX_ERR(0, 1593, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.spectrum", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_8pysndlib_3clm_106spectrum(__pyx_self, __pyx_v_rdat, __pyx_v_idat, __pyx_v_window, __pyx_v_norm_type);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_106spectrum(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_rdat, PyObject *__pyx_v_idat, PyObject *__pyx_v_window, PyObject *__pyx_v_norm_type) {
Py_ssize_t __pyx_v_size;
PyObject *__pyx_v_rdat_cpy = NULL;
PyObject *__pyx_v_idat_cpy = NULL;
__Pyx_memviewslice __pyx_v_rdat_view = { 0, 0, { 0 }, { 0 }, { 0 } };
__Pyx_memviewslice __pyx_v_idat_view = { 0, 0, { 0 }, { 0 }, { 0 } };
__Pyx_memviewslice __pyx_v_window_view = { 0, 0, { 0 }, { 0 }, { 0 } };
PyObject *__pyx_r = NULL;
__Pyx_INCREF(__pyx_v_window);
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_XDECREF(__pyx_t_5);
__Pyx_XDECREF(__pyx_t_6);
__PYX_XCLEAR_MEMVIEW(&__pyx_t_9, 1);
__Pyx_AddTraceback("pysndlib.clm.spectrum", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XDECREF(__pyx_v_rdat_cpy);
__Pyx_XDECREF(__pyx_v_idat_cpy);
__PYX_XCLEAR_MEMVIEW(&__pyx_v_rdat_view, 1);
__PYX_XCLEAR_MEMVIEW(&__pyx_v_idat_view, 1);
__PYX_XCLEAR_MEMVIEW(&__pyx_v_window_view, 1);
__Pyx_XDECREF(__pyx_v_window);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_tuple__235 = PyTuple_Pack(10, __pyx_n_s_rdat, __pyx_n_s_idat, __pyx_n_s_window, __pyx_n_s_norm_type, __pyx_n_s_size, __pyx_n_s_rdat_cpy, __pyx_n_s_idat_cpy, __pyx_n_s_rdat_view, __pyx_n_s_idat_view, __pyx_n_s_window_view); if (unlikely(!__pyx_tuple__235)) __PYX_ERR(0, 1593, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__235);
__Pyx_GIVEREF(__pyx_tuple__235);
/* … */
__pyx_t_43 = __Pyx_PyDict_NewPresized(4); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 1593, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
if (PyDict_SetItem(__pyx_t_43, __pyx_n_s_rdat, __pyx_kp_s_npt_NDArray_np_float64) < 0) __PYX_ERR(0, 1593, __pyx_L1_error)
if (PyDict_SetItem(__pyx_t_43, __pyx_n_s_idat, __pyx_kp_s_npt_NDArray_np_float64) < 0) __PYX_ERR(0, 1593, __pyx_L1_error)
if (PyDict_SetItem(__pyx_t_43, __pyx_n_s_window, __pyx_kp_s_npt_NDArray_np_float64) < 0) __PYX_ERR(0, 1593, __pyx_L1_error)
if (PyDict_SetItem(__pyx_t_43, __pyx_n_s_norm_type, __pyx_kp_s_Optional_Spectrum) < 0) __PYX_ERR(0, 1593, __pyx_L1_error)
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_107spectrum, 0, __pyx_n_s_spectrum, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__236)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 1593, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
if (!__Pyx_CyFunction_InitDefaults(__pyx_t_40, sizeof(__pyx_defaults2), 1)) __PYX_ERR(0, 1593, __pyx_L1_error)
__pyx_t_37 = __Pyx_Enum_Spectrum_to_py(__pyx_e_8pysndlib_3clm_IN_DB); if (unlikely(!__pyx_t_37)) __PYX_ERR(0, 1593, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_37);
__Pyx_CyFunction_Defaults(__pyx_defaults2, __pyx_t_40)->__pyx_arg_norm_type = __pyx_t_37;
__Pyx_GIVEREF(__pyx_t_37);
__pyx_t_37 = 0;
__Pyx_CyFunction_SetDefaultsGetter(__pyx_t_40, __pyx_pf_8pysndlib_3clm_633__defaults__);
__Pyx_CyFunction_SetAnnotationsDict(__pyx_t_40, __pyx_t_43);
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
if (PyDict_SetItem(__pyx_d, __pyx_n_s_spectrum, __pyx_t_40) < 0) __PYX_ERR(0, 1593, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
__pyx_codeobj__236 = (PyObject*)__Pyx_PyCode_New(4, 0, 0, 10, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__235, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_spectrum, 1593, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__236)) __PYX_ERR(0, 1593, __pyx_L1_error)
1594: """
1595: real and imaginary data in ndarrays rl and im, returns (in rl) the spectrum thereof; window is the
1596: fft data window (a ndarray as returned by make_fft_window and type determines how the spectral data is
1597: scaled:
1598: spectrum.in_db= data in db,
1599: spectrum.normalized (default) = linear and normalized
1600: spectrum.raw = linear and un-normalized.
1601:
1602: :param rdat: real data
1603: :param imaginary: imaginary data
1604: :param window: fft window
1605: :param norm_type: normalization type
1606: :return: spectrum
1607: :rtype: np.ndarray
1608:
1609: """
+1610: if isinstance(window, list):
__pyx_t_1 = PyList_Check(__pyx_v_window);
if (__pyx_t_1) {
/* … */
}
+1611: window = np.array(window, dtype=np.double)
__Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1611, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_array); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1611, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1611, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_v_window); __Pyx_GIVEREF(__pyx_v_window); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_window)) __PYX_ERR(0, 1611, __pyx_L1_error); __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1611, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1611, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_double); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1611, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_dtype, __pyx_t_6) < 0) __PYX_ERR(0, 1611, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_2, __pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1611, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF_SET(__pyx_v_window, __pyx_t_6); __pyx_t_6 = 0;
+1612: size = len(rdat)
__pyx_t_7 = PyObject_Length(__pyx_v_rdat); if (unlikely(__pyx_t_7 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1612, __pyx_L1_error) __pyx_v_size = __pyx_t_7;
+1613: check_ndim(rdat)
__pyx_t_6 = __pyx_f_8pysndlib_3clm_check_ndim(__pyx_v_rdat, 0, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1613, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+1614: check_ndim(idat)
__pyx_t_6 = __pyx_f_8pysndlib_3clm_check_ndim(__pyx_v_idat, 0, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1614, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+1615: check_ndim(window)
__pyx_t_6 = __pyx_f_8pysndlib_3clm_check_ndim(__pyx_v_window, 0, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1615, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+1616: compare_shapes(rdat, idat)
__pyx_t_6 = __pyx_f_8pysndlib_3clm_compare_shapes(__pyx_v_rdat, __pyx_v_idat, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1616, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+1617: rdat_cpy = np.copy(rdat)
__Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1617, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_copy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1617, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = NULL; __pyx_t_8 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_2))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); __pyx_t_8 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v_rdat}; __pyx_t_6 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_8, 1+__pyx_t_8); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1617, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } __pyx_v_rdat_cpy = __pyx_t_6; __pyx_t_6 = 0;
+1618: idat_cpy = np.copy(idat) #probably don't need to do this because idat should not be changed
__Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1618, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_copy); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1618, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = NULL; __pyx_t_8 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_4))) { __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4); if (likely(__pyx_t_2)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); __Pyx_INCREF(__pyx_t_2); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_4, function); __pyx_t_8 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_v_idat}; __pyx_t_6 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_8, 1+__pyx_t_8); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1618, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } __pyx_v_idat_cpy = __pyx_t_6; __pyx_t_6 = 0;
1619:
+1620: cdef double [:] rdat_view = rdat_cpy
__pyx_t_9 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_v_rdat_cpy, PyBUF_WRITABLE); if (unlikely(!__pyx_t_9.memview)) __PYX_ERR(0, 1620, __pyx_L1_error) __pyx_v_rdat_view = __pyx_t_9; __pyx_t_9.memview = NULL; __pyx_t_9.data = NULL;
+1621: cdef double [:] idat_view = idat_cpy
__pyx_t_9 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_v_idat_cpy, PyBUF_WRITABLE); if (unlikely(!__pyx_t_9.memview)) __PYX_ERR(0, 1621, __pyx_L1_error) __pyx_v_idat_view = __pyx_t_9; __pyx_t_9.memview = NULL; __pyx_t_9.data = NULL;
+1622: cdef double [:] window_view = window
__pyx_t_9 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_v_window, PyBUF_WRITABLE); if (unlikely(!__pyx_t_9.memview)) __PYX_ERR(0, 1622, __pyx_L1_error) __pyx_v_window_view = __pyx_t_9; __pyx_t_9.memview = NULL; __pyx_t_9.data = NULL;
1623:
+1624: cclm.mus_spectrum(&rdat_view[0], &idat_view[0], &window_view[0], size, <cclm.mus_spectrum_t>norm_type)
__pyx_t_10 = 0;
__pyx_t_8 = -1;
if (__pyx_t_10 < 0) {
__pyx_t_10 += __pyx_v_rdat_view.shape[0];
if (unlikely(__pyx_t_10 < 0)) __pyx_t_8 = 0;
} else if (unlikely(__pyx_t_10 >= __pyx_v_rdat_view.shape[0])) __pyx_t_8 = 0;
if (unlikely(__pyx_t_8 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_8);
__PYX_ERR(0, 1624, __pyx_L1_error)
}
__pyx_t_11 = 0;
__pyx_t_8 = -1;
if (__pyx_t_11 < 0) {
__pyx_t_11 += __pyx_v_idat_view.shape[0];
if (unlikely(__pyx_t_11 < 0)) __pyx_t_8 = 0;
} else if (unlikely(__pyx_t_11 >= __pyx_v_idat_view.shape[0])) __pyx_t_8 = 0;
if (unlikely(__pyx_t_8 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_8);
__PYX_ERR(0, 1624, __pyx_L1_error)
}
__pyx_t_12 = 0;
__pyx_t_8 = -1;
if (__pyx_t_12 < 0) {
__pyx_t_12 += __pyx_v_window_view.shape[0];
if (unlikely(__pyx_t_12 < 0)) __pyx_t_8 = 0;
} else if (unlikely(__pyx_t_12 >= __pyx_v_window_view.shape[0])) __pyx_t_8 = 0;
if (unlikely(__pyx_t_8 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_8);
__PYX_ERR(0, 1624, __pyx_L1_error)
}
__pyx_t_13 = ((mus_spectrum_t)__Pyx_PyInt_As_mus_spectrum_t(__pyx_v_norm_type)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1624, __pyx_L1_error)
(void)(mus_spectrum((&(*((double *) ( /* dim=0 */ (__pyx_v_rdat_view.data + __pyx_t_10 * __pyx_v_rdat_view.strides[0]) )))), (&(*((double *) ( /* dim=0 */ (__pyx_v_idat_view.data + __pyx_t_11 * __pyx_v_idat_view.strides[0]) )))), (&(*((double *) ( /* dim=0 */ (__pyx_v_window_view.data + __pyx_t_12 * __pyx_v_window_view.strides[0]) )))), __pyx_v_size, ((mus_spectrum_t)__pyx_t_13)));
+1625: return rdat_cpy
__Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_v_rdat_cpy); __pyx_r = __pyx_v_rdat_cpy; goto __pyx_L0;
1626:
1627:
+1628: cpdef np.ndarray mus_convolution(np.ndarray rl1, np.ndarray rl2, fft_size = None):
static PyObject *__pyx_pw_8pysndlib_3clm_109mus_convolution(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyArrayObject *__pyx_f_8pysndlib_3clm_mus_convolution(PyArrayObject *__pyx_v_rl1, PyArrayObject *__pyx_v_rl2, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_8pysndlib_3clm_mus_convolution *__pyx_optional_args) {
Py_ssize_t __pyx_v_size;
__Pyx_memviewslice __pyx_v_rl1_view = { 0, 0, { 0 }, { 0 }, { 0 } };
__Pyx_memviewslice __pyx_v_rl2_view = { 0, 0, { 0 }, { 0 }, { 0 } };
PyArrayObject *__pyx_r = NULL;
if (__pyx_optional_args) {
}
/* … */
/* function exit code */
__pyx_L1_error:;
__PYX_XCLEAR_MEMVIEW(&__pyx_t_2, 1);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_AddTraceback("pysndlib.clm.mus_convolution", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__PYX_XCLEAR_MEMVIEW(&__pyx_v_rl1_view, 1);
__PYX_XCLEAR_MEMVIEW(&__pyx_v_rl2_view, 1);
__Pyx_XGIVEREF((PyObject *)__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_109mus_convolution(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_108mus_convolution, "\n in-place operation. convolution of ndarrays v1 with v2, using fft of size len (a power of 2), result in v1.\n\n :param rl1: input data 1\n :param rl2: input data 2\n :param fft_size: fft size\n :return: convolved output. also written into rl1\n :rtype: np.ndarray\n \n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_109mus_convolution = {"mus_convolution", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_109mus_convolution, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_108mus_convolution};
static PyObject *__pyx_pw_8pysndlib_3clm_109mus_convolution(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
PyArrayObject *__pyx_v_rl1 = 0;
PyArrayObject *__pyx_v_rl2 = 0;
PyObject *__pyx_v_fft_size = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("mus_convolution (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_rl1,&__pyx_n_s_rl2,&__pyx_n_s_fft_size,0};
PyObject* values[3] = {0,0,0};
values[2] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_rl1)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1628, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_rl2)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1628, __pyx_L3_error)
else {
__Pyx_RaiseArgtupleInvalid("mus_convolution", 0, 2, 3, 1); __PYX_ERR(0, 1628, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 2:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_fft_size);
if (value) { values[2] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1628, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "mus_convolution") < 0)) __PYX_ERR(0, 1628, __pyx_L3_error)
}
} else {
switch (__pyx_nargs) {
case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
break;
default: goto __pyx_L5_argtuple_error;
}
}
__pyx_v_rl1 = ((PyArrayObject *)values[0]);
__pyx_v_rl2 = ((PyArrayObject *)values[1]);
__pyx_v_fft_size = values[2];
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("mus_convolution", 0, 2, 3, __pyx_nargs); __PYX_ERR(0, 1628, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.mus_convolution", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_rl1), __pyx_ptype_5numpy_ndarray, 1, "rl1", 0))) __PYX_ERR(0, 1628, __pyx_L1_error)
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_rl2), __pyx_ptype_5numpy_ndarray, 1, "rl2", 0))) __PYX_ERR(0, 1628, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_108mus_convolution(__pyx_self, __pyx_v_rl1, __pyx_v_rl2, __pyx_v_fft_size);
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_108mus_convolution(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_rl1, PyArrayObject *__pyx_v_rl2, PyObject *__pyx_v_fft_size) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_2.__pyx_n = 1;
__pyx_t_2.fft_size = __pyx_v_fft_size;
__pyx_t_1 = ((PyObject *)__pyx_f_8pysndlib_3clm_mus_convolution(__pyx_v_rl1, __pyx_v_rl2, 0, &__pyx_t_2)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1628, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("pysndlib.clm.mus_convolution", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_tuple__237 = PyTuple_Pack(3, __pyx_n_s_rl1, __pyx_n_s_rl2, __pyx_n_s_fft_size); if (unlikely(!__pyx_tuple__237)) __PYX_ERR(0, 1628, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__237);
__Pyx_GIVEREF(__pyx_tuple__237);
/* … */
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_109mus_convolution, 0, __pyx_n_s_mus_convolution, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__238)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 1628, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
__Pyx_CyFunction_SetDefaultsTuple(__pyx_t_40, __pyx_tuple__90);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_mus_convolution, __pyx_t_40) < 0) __PYX_ERR(0, 1628, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
__pyx_codeobj__238 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__237, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_mus_convolution, 1628, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__238)) __PYX_ERR(0, 1628, __pyx_L1_error)
1629: """
1630: in-place operation. convolution of ndarrays v1 with v2, using fft of size len (a power of 2), result in v1.
1631:
1632: :param rl1: input data 1
1633: :param rl2: input data 2
1634: :param fft_size: fft size
1635: :return: convolved output. also written into rl1
1636: :rtype: np.ndarray
1637:
1638: """
+1639: size = len(rl1)
__pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_rl1)); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1639, __pyx_L1_error) __pyx_v_size = __pyx_t_1;
+1640: cdef double [:] rl1_view = rl1
__pyx_t_2 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(((PyObject *)__pyx_v_rl1), PyBUF_WRITABLE); if (unlikely(!__pyx_t_2.memview)) __PYX_ERR(0, 1640, __pyx_L1_error) __pyx_v_rl1_view = __pyx_t_2; __pyx_t_2.memview = NULL; __pyx_t_2.data = NULL;
+1641: cdef double [:] rl2_view = rl2
__pyx_t_2 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(((PyObject *)__pyx_v_rl2), PyBUF_WRITABLE); if (unlikely(!__pyx_t_2.memview)) __PYX_ERR(0, 1641, __pyx_L1_error) __pyx_v_rl2_view = __pyx_t_2; __pyx_t_2.memview = NULL; __pyx_t_2.data = NULL;
+1642: check_ndim(rl1)
__pyx_t_3 = __pyx_f_8pysndlib_3clm_check_ndim(((PyObject *)__pyx_v_rl1), 0, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1642, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+1643: check_ndim(rl2)
__pyx_t_3 = __pyx_f_8pysndlib_3clm_check_ndim(((PyObject *)__pyx_v_rl2), 0, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1643, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+1644: compare_shapes(rl1, rl2)
__pyx_t_3 = __pyx_f_8pysndlib_3clm_compare_shapes(((PyObject *)__pyx_v_rl1), ((PyObject *)__pyx_v_rl2), 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1644, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
1645:
+1646: cclm.mus_convolution(&rl1_view[0], &rl2_view[0], size)
__pyx_t_4 = 0;
__pyx_t_5 = -1;
if (__pyx_t_4 < 0) {
__pyx_t_4 += __pyx_v_rl1_view.shape[0];
if (unlikely(__pyx_t_4 < 0)) __pyx_t_5 = 0;
} else if (unlikely(__pyx_t_4 >= __pyx_v_rl1_view.shape[0])) __pyx_t_5 = 0;
if (unlikely(__pyx_t_5 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_5);
__PYX_ERR(0, 1646, __pyx_L1_error)
}
__pyx_t_6 = 0;
__pyx_t_5 = -1;
if (__pyx_t_6 < 0) {
__pyx_t_6 += __pyx_v_rl2_view.shape[0];
if (unlikely(__pyx_t_6 < 0)) __pyx_t_5 = 0;
} else if (unlikely(__pyx_t_6 >= __pyx_v_rl2_view.shape[0])) __pyx_t_5 = 0;
if (unlikely(__pyx_t_5 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_5);
__PYX_ERR(0, 1646, __pyx_L1_error)
}
(void)(mus_convolution((&(*((double *) ( /* dim=0 */ (__pyx_v_rl1_view.data + __pyx_t_4 * __pyx_v_rl1_view.strides[0]) )))), (&(*((double *) ( /* dim=0 */ (__pyx_v_rl2_view.data + __pyx_t_6 * __pyx_v_rl2_view.strides[0]) )))), __pyx_v_size));
+1647: return rl1
__Pyx_XDECREF((PyObject *)__pyx_r); __Pyx_INCREF((PyObject *)__pyx_v_rl1); __pyx_r = __pyx_v_rl1; goto __pyx_L0;
1648:
1649:
1650:
+1651: def convolution(rl1: npt.NDArray[np.float64], rl2: npt.NDArray[np.float64], fft_size: Optional[cython.int] = None):
/* Python wrapper */ static PyObject *__pyx_pw_8pysndlib_3clm_111convolution(PyObject *__pyx_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_110convolution, "\n convolution of ndarrays v1 with v2, using fft of size len (a power of 2), result in v1.\n\n :param rl1: input data 1\n :param rl2: input data 2\n :param fft_size: fft size\n :return: convolved output.\n :rtype: np.ndarray\n \n "); static PyMethodDef __pyx_mdef_8pysndlib_3clm_111convolution = {"convolution", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_111convolution, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_110convolution}; static PyObject *__pyx_pw_8pysndlib_3clm_111convolution(PyObject *__pyx_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { PyObject *__pyx_v_rl1 = 0; PyObject *__pyx_v_rl2 = 0; CYTHON_UNUSED PyObject *__pyx_v_fft_size = 0; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("convolution (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_MACROS __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { PyObject **__pyx_pyargnames[] = {&__pyx_n_s_rl1,&__pyx_n_s_rl2,&__pyx_n_s_fft_size,0}; PyObject* values[3] = {0,0,0}; values[2] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None)); if (__pyx_kwds) { Py_ssize_t kw_args; switch (__pyx_nargs) { case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); CYTHON_FALLTHROUGH; case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); CYTHON_FALLTHROUGH; case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); switch (__pyx_nargs) { case 0: if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_rl1)) != 0)) { (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); kw_args--; } else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1651, __pyx_L3_error) else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_rl2)) != 0)) { (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); kw_args--; } else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1651, __pyx_L3_error) else { __Pyx_RaiseArgtupleInvalid("convolution", 0, 2, 3, 1); __PYX_ERR(0, 1651, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: if (kw_args > 0) { PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_fft_size); if (value) { values[2] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1651, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { const Py_ssize_t kwd_pos_args = __pyx_nargs; if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "convolution") < 0)) __PYX_ERR(0, 1651, __pyx_L3_error) } } else { switch (__pyx_nargs) { case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); CYTHON_FALLTHROUGH; case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); break; default: goto __pyx_L5_argtuple_error; } } __pyx_v_rl1 = values[0]; __pyx_v_rl2 = values[1]; __pyx_v_fft_size = values[2]; } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("convolution", 0, 2, 3, __pyx_nargs); __PYX_ERR(0, 1651, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; { Py_ssize_t __pyx_temp; for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); } } __Pyx_AddTraceback("pysndlib.clm.convolution", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_8pysndlib_3clm_110convolution(__pyx_self, __pyx_v_rl1, __pyx_v_rl2, __pyx_v_fft_size); /* function exit code */ { Py_ssize_t __pyx_temp; for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); } } __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_8pysndlib_3clm_110convolution(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_rl1, PyObject *__pyx_v_rl2, CYTHON_UNUSED PyObject *__pyx_v_fft_size) { Py_ssize_t __pyx_v_size; PyObject *__pyx_v_rl1_cpy = NULL; PyObject *__pyx_v_rl2_cpy = NULL; __Pyx_memviewslice __pyx_v_rl1_view = { 0, 0, { 0 }, { 0 }, { 0 } }; __Pyx_memviewslice __pyx_v_rl2_view = { 0, 0, { 0 }, { 0 }, { 0 } }; PyObject *__pyx_r = NULL; /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __PYX_XCLEAR_MEMVIEW(&__pyx_t_6, 1); __Pyx_AddTraceback("pysndlib.clm.convolution", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_rl1_cpy); __Pyx_XDECREF(__pyx_v_rl2_cpy); __PYX_XCLEAR_MEMVIEW(&__pyx_v_rl1_view, 1); __PYX_XCLEAR_MEMVIEW(&__pyx_v_rl2_view, 1); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__239 = PyTuple_Pack(8, __pyx_n_s_rl1, __pyx_n_s_rl2, __pyx_n_s_fft_size, __pyx_n_s_size, __pyx_n_s_rl1_cpy, __pyx_n_s_rl2_cpy, __pyx_n_s_rl1_view, __pyx_n_s_rl2_view); if (unlikely(!__pyx_tuple__239)) __PYX_ERR(0, 1651, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__239); __Pyx_GIVEREF(__pyx_tuple__239); /* … */ __pyx_t_40 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 1651, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_40); if (PyDict_SetItem(__pyx_t_40, __pyx_n_s_rl1, __pyx_kp_s_npt_NDArray_np_float64) < 0) __PYX_ERR(0, 1651, __pyx_L1_error) if (PyDict_SetItem(__pyx_t_40, __pyx_n_s_rl2, __pyx_kp_s_npt_NDArray_np_float64) < 0) __PYX_ERR(0, 1651, __pyx_L1_error) if (PyDict_SetItem(__pyx_t_40, __pyx_n_s_fft_size, __pyx_kp_s_Optional_cython_int) < 0) __PYX_ERR(0, 1651, __pyx_L1_error) __pyx_t_43 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_111convolution, 0, __pyx_n_s_convolution, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__240)); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 1651, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_43); __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_43, __pyx_tuple__90); __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_43, __pyx_t_40); __Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0; if (PyDict_SetItem(__pyx_d, __pyx_n_s_convolution, __pyx_t_43) < 0) __PYX_ERR(0, 1651, __pyx_L1_error) __Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0; __pyx_codeobj__240 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 8, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__239, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_convolution, 1651, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__240)) __PYX_ERR(0, 1651, __pyx_L1_error)
1652: """
1653: convolution of ndarrays v1 with v2, using fft of size len (a power of 2), result in v1.
1654:
1655: :param rl1: input data 1
1656: :param rl2: input data 2
1657: :param fft_size: fft size
1658: :return: convolved output.
1659: :rtype: np.ndarray
1660:
1661: """
+1662: size = len(rl1)
__pyx_t_1 = PyObject_Length(__pyx_v_rl1); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1662, __pyx_L1_error) __pyx_v_size = __pyx_t_1;
+1663: check_ndim(rl1)
__pyx_t_2 = __pyx_f_8pysndlib_3clm_check_ndim(__pyx_v_rl1, 0, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1663, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+1664: check_ndim(rl2)
__pyx_t_2 = __pyx_f_8pysndlib_3clm_check_ndim(__pyx_v_rl2, 0, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1664, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+1665: compare_shapes(rl1, rl2)
__pyx_t_2 = __pyx_f_8pysndlib_3clm_compare_shapes(__pyx_v_rl1, __pyx_v_rl2, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1665, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+1666: rl1_cpy = np.copy(rl1)
__Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1666, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_copy); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1666, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = NULL; __pyx_t_5 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_4))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_4, function); __pyx_t_5 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v_rl1}; __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1666, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } __pyx_v_rl1_cpy = __pyx_t_2; __pyx_t_2 = 0;
+1667: rl2_cpy = np.copy(rl2) #probably do
__Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1667, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_copy); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1667, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = NULL; __pyx_t_5 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_3))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); __pyx_t_5 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v_rl2}; __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1667, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } __pyx_v_rl2_cpy = __pyx_t_2; __pyx_t_2 = 0;
1668:
1669:
+1670: cdef double [:] rl1_view = rl1_cpy
__pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_v_rl1_cpy, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 1670, __pyx_L1_error) __pyx_v_rl1_view = __pyx_t_6; __pyx_t_6.memview = NULL; __pyx_t_6.data = NULL;
+1671: cdef double [:] rl2_view = rl2_cpy
__pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_v_rl2_cpy, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 1671, __pyx_L1_error) __pyx_v_rl2_view = __pyx_t_6; __pyx_t_6.memview = NULL; __pyx_t_6.data = NULL;
1672:
1673:
+1674: cclm.mus_convolution(&rl1_view[0], &rl2_view[0], size)
__pyx_t_7 = 0;
__pyx_t_5 = -1;
if (__pyx_t_7 < 0) {
__pyx_t_7 += __pyx_v_rl1_view.shape[0];
if (unlikely(__pyx_t_7 < 0)) __pyx_t_5 = 0;
} else if (unlikely(__pyx_t_7 >= __pyx_v_rl1_view.shape[0])) __pyx_t_5 = 0;
if (unlikely(__pyx_t_5 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_5);
__PYX_ERR(0, 1674, __pyx_L1_error)
}
__pyx_t_8 = 0;
__pyx_t_5 = -1;
if (__pyx_t_8 < 0) {
__pyx_t_8 += __pyx_v_rl2_view.shape[0];
if (unlikely(__pyx_t_8 < 0)) __pyx_t_5 = 0;
} else if (unlikely(__pyx_t_8 >= __pyx_v_rl2_view.shape[0])) __pyx_t_5 = 0;
if (unlikely(__pyx_t_5 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_5);
__PYX_ERR(0, 1674, __pyx_L1_error)
}
(void)(mus_convolution((&(*((double *) ( /* dim=0 */ (__pyx_v_rl1_view.data + __pyx_t_7 * __pyx_v_rl1_view.strides[0]) )))), (&(*((double *) ( /* dim=0 */ (__pyx_v_rl2_view.data + __pyx_t_8 * __pyx_v_rl2_view.strides[0]) )))), __pyx_v_size));
+1675: return rl1_cpy
__Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_v_rl1_cpy); __pyx_r = __pyx_v_rl1_cpy; goto __pyx_L0;
1676:
+1677: cpdef np.ndarray mus_autocorrelate(np.ndarray data):
static PyObject *__pyx_pw_8pysndlib_3clm_113mus_autocorrelate(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyArrayObject *__pyx_f_8pysndlib_3clm_mus_autocorrelate(PyArrayObject *__pyx_v_data, CYTHON_UNUSED int __pyx_skip_dispatch) {
Py_ssize_t __pyx_v_size;
__Pyx_memviewslice __pyx_v_data_view = { 0, 0, { 0 }, { 0 }, { 0 } };
PyArrayObject *__pyx_r = NULL;
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__PYX_XCLEAR_MEMVIEW(&__pyx_t_3, 1);
__Pyx_AddTraceback("pysndlib.clm.mus_autocorrelate", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__PYX_XCLEAR_MEMVIEW(&__pyx_v_data_view, 1);
__Pyx_XGIVEREF((PyObject *)__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_113mus_autocorrelate(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_112mus_autocorrelate, "\n in place autocorrelation of data (a ndarray).\n\n :param data: data\n :return: autocorrelation result\n :rtype: np.ndarray\n\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_113mus_autocorrelate = {"mus_autocorrelate", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_113mus_autocorrelate, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_112mus_autocorrelate};
static PyObject *__pyx_pw_8pysndlib_3clm_113mus_autocorrelate(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
PyArrayObject *__pyx_v_data = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("mus_autocorrelate (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_data,0};
PyObject* values[1] = {0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_data)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1677, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "mus_autocorrelate") < 0)) __PYX_ERR(0, 1677, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 1)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
}
__pyx_v_data = ((PyArrayObject *)values[0]);
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("mus_autocorrelate", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 1677, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.mus_autocorrelate", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_data), __pyx_ptype_5numpy_ndarray, 1, "data", 0))) __PYX_ERR(0, 1677, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_112mus_autocorrelate(__pyx_self, __pyx_v_data);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_112mus_autocorrelate(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_data) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = ((PyObject *)__pyx_f_8pysndlib_3clm_mus_autocorrelate(__pyx_v_data, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1677, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("pysndlib.clm.mus_autocorrelate", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_tuple__241 = PyTuple_Pack(1, __pyx_n_s_data); if (unlikely(!__pyx_tuple__241)) __PYX_ERR(0, 1677, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__241);
__Pyx_GIVEREF(__pyx_tuple__241);
/* … */
__pyx_t_43 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_113mus_autocorrelate, 0, __pyx_n_s_mus_autocorrelate, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__242)); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 1677, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_mus_autocorrelate, __pyx_t_43) < 0) __PYX_ERR(0, 1677, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
__pyx_codeobj__242 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__241, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_mus_autocorrelate, 1677, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__242)) __PYX_ERR(0, 1677, __pyx_L1_error)
1678: """
1679: in place autocorrelation of data (a ndarray).
1680:
1681: :param data: data
1682: :return: autocorrelation result
1683: :rtype: np.ndarray
1684:
1685: """
+1686: size = len(data)
__pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_data)); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1686, __pyx_L1_error) __pyx_v_size = __pyx_t_1;
+1687: check_ndim(data)
__pyx_t_2 = __pyx_f_8pysndlib_3clm_check_ndim(((PyObject *)__pyx_v_data), 0, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1687, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
1688:
+1689: cdef double [:] data_view = data
__pyx_t_3 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(((PyObject *)__pyx_v_data), PyBUF_WRITABLE); if (unlikely(!__pyx_t_3.memview)) __PYX_ERR(0, 1689, __pyx_L1_error) __pyx_v_data_view = __pyx_t_3; __pyx_t_3.memview = NULL; __pyx_t_3.data = NULL;
+1690: cclm.mus_autocorrelate(&data_view[0], size)
__pyx_t_4 = 0;
__pyx_t_5 = -1;
if (__pyx_t_4 < 0) {
__pyx_t_4 += __pyx_v_data_view.shape[0];
if (unlikely(__pyx_t_4 < 0)) __pyx_t_5 = 0;
} else if (unlikely(__pyx_t_4 >= __pyx_v_data_view.shape[0])) __pyx_t_5 = 0;
if (unlikely(__pyx_t_5 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_5);
__PYX_ERR(0, 1690, __pyx_L1_error)
}
(void)(mus_autocorrelate((&(*((double *) ( /* dim=0 */ (__pyx_v_data_view.data + __pyx_t_4 * __pyx_v_data_view.strides[0]) )))), __pyx_v_size));
+1691: return data
__Pyx_XDECREF((PyObject *)__pyx_r); __Pyx_INCREF((PyObject *)__pyx_v_data); __pyx_r = __pyx_v_data; goto __pyx_L0;
1692:
1693:
+1694: def autocorrelate(data: npt.NDArray[np.float64]):
/* Python wrapper */ static PyObject *__pyx_pw_8pysndlib_3clm_115autocorrelate(PyObject *__pyx_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_114autocorrelate, "\n autocorrelation of data (a ndarray).\n\n :param data: data\n :return: autocorrelation result\n :rtype: np.ndarray\n\n "); static PyMethodDef __pyx_mdef_8pysndlib_3clm_115autocorrelate = {"autocorrelate", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_115autocorrelate, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_114autocorrelate}; static PyObject *__pyx_pw_8pysndlib_3clm_115autocorrelate(PyObject *__pyx_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { PyObject *__pyx_v_data = 0; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("autocorrelate (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_MACROS __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { PyObject **__pyx_pyargnames[] = {&__pyx_n_s_data,0}; PyObject* values[1] = {0}; if (__pyx_kwds) { Py_ssize_t kw_args; switch (__pyx_nargs) { case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); switch (__pyx_nargs) { case 0: if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_data)) != 0)) { (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); kw_args--; } else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1694, __pyx_L3_error) else goto __pyx_L5_argtuple_error; } if (unlikely(kw_args > 0)) { const Py_ssize_t kwd_pos_args = __pyx_nargs; if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "autocorrelate") < 0)) __PYX_ERR(0, 1694, __pyx_L3_error) } } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); } __pyx_v_data = values[0]; } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("autocorrelate", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 1694, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; { Py_ssize_t __pyx_temp; for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); } } __Pyx_AddTraceback("pysndlib.clm.autocorrelate", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_8pysndlib_3clm_114autocorrelate(__pyx_self, __pyx_v_data); int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; /* function exit code */ { Py_ssize_t __pyx_temp; for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); } } __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_8pysndlib_3clm_114autocorrelate(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_data) { Py_ssize_t __pyx_v_size; PyObject *__pyx_v_data_cpy = NULL; __Pyx_memviewslice __pyx_v_data_view = { 0, 0, { 0 }, { 0 }, { 0 } }; PyObject *__pyx_r = NULL; /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __PYX_XCLEAR_MEMVIEW(&__pyx_t_6, 1); __Pyx_AddTraceback("pysndlib.clm.autocorrelate", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_data_cpy); __PYX_XCLEAR_MEMVIEW(&__pyx_v_data_view, 1); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__243 = PyTuple_Pack(4, __pyx_n_s_data, __pyx_n_s_size, __pyx_n_s_data_cpy, __pyx_n_s_data_view); if (unlikely(!__pyx_tuple__243)) __PYX_ERR(0, 1694, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__243); __Pyx_GIVEREF(__pyx_tuple__243); /* … */ __pyx_t_43 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 1694, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_43); if (PyDict_SetItem(__pyx_t_43, __pyx_n_s_data, __pyx_kp_s_npt_NDArray_np_float64) < 0) __PYX_ERR(0, 1694, __pyx_L1_error) __pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_115autocorrelate, 0, __pyx_n_s_autocorrelate, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__244)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 1694, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_40); __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_40, __pyx_t_43); __Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0; if (PyDict_SetItem(__pyx_d, __pyx_n_s_autocorrelate, __pyx_t_40) < 0) __PYX_ERR(0, 1694, __pyx_L1_error) __Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0; __pyx_codeobj__244 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__243, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_autocorrelate, 1694, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__244)) __PYX_ERR(0, 1694, __pyx_L1_error)
1695: """
1696: autocorrelation of data (a ndarray).
1697:
1698: :param data: data
1699: :return: autocorrelation result
1700: :rtype: np.ndarray
1701:
1702: """
+1703: size = len(data)
__pyx_t_1 = PyObject_Length(__pyx_v_data); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1703, __pyx_L1_error) __pyx_v_size = __pyx_t_1;
+1704: check_ndim(data)
__pyx_t_2 = __pyx_f_8pysndlib_3clm_check_ndim(__pyx_v_data, 0, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1704, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+1705: data_cpy = np.copy(data) #probably do
__Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1705, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_copy); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1705, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = NULL; __pyx_t_5 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_4))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_4, function); __pyx_t_5 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v_data}; __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1705, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } __pyx_v_data_cpy = __pyx_t_2; __pyx_t_2 = 0;
1706:
+1707: cdef double [:] data_view = data_cpy
__pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_v_data_cpy, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 1707, __pyx_L1_error) __pyx_v_data_view = __pyx_t_6; __pyx_t_6.memview = NULL; __pyx_t_6.data = NULL;
+1708: cclm.mus_autocorrelate(&data_view[0], size)
__pyx_t_7 = 0;
__pyx_t_5 = -1;
if (__pyx_t_7 < 0) {
__pyx_t_7 += __pyx_v_data_view.shape[0];
if (unlikely(__pyx_t_7 < 0)) __pyx_t_5 = 0;
} else if (unlikely(__pyx_t_7 >= __pyx_v_data_view.shape[0])) __pyx_t_5 = 0;
if (unlikely(__pyx_t_5 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_5);
__PYX_ERR(0, 1708, __pyx_L1_error)
}
(void)(mus_autocorrelate((&(*((double *) ( /* dim=0 */ (__pyx_v_data_view.data + __pyx_t_7 * __pyx_v_data_view.strides[0]) )))), __pyx_v_size));
+1709: return data_cpy
__Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_v_data_cpy); __pyx_r = __pyx_v_data_cpy; goto __pyx_L0;
1710:
+1711: cpdef np.ndarray mus_correlate( np.ndarray data1, np.ndarray data2):
static PyObject *__pyx_pw_8pysndlib_3clm_117mus_correlate(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyArrayObject *__pyx_f_8pysndlib_3clm_mus_correlate(PyArrayObject *__pyx_v_data1, PyArrayObject *__pyx_v_data2, CYTHON_UNUSED int __pyx_skip_dispatch) {
Py_ssize_t __pyx_v_size;
__Pyx_memviewslice __pyx_v_data1_view = { 0, 0, { 0 }, { 0 }, { 0 } };
__Pyx_memviewslice __pyx_v_data2_view = { 0, 0, { 0 }, { 0 }, { 0 } };
PyArrayObject *__pyx_r = NULL;
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__PYX_XCLEAR_MEMVIEW(&__pyx_t_3, 1);
__Pyx_AddTraceback("pysndlib.clm.mus_correlate", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__PYX_XCLEAR_MEMVIEW(&__pyx_v_data1_view, 1);
__PYX_XCLEAR_MEMVIEW(&__pyx_v_data2_view, 1);
__Pyx_XGIVEREF((PyObject *)__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_117mus_correlate(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_116mus_correlate, "\n in place cross-correlation of data1 and data2 (both ndarrays).\n \n :param data1: data 1\n :param data2: data 2\n :return: correlation result written into data1\n :rtype: np.ndarray\n \n \n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_117mus_correlate = {"mus_correlate", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_117mus_correlate, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_116mus_correlate};
static PyObject *__pyx_pw_8pysndlib_3clm_117mus_correlate(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
PyArrayObject *__pyx_v_data1 = 0;
PyArrayObject *__pyx_v_data2 = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("mus_correlate (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_data1,&__pyx_n_s_data2,0};
PyObject* values[2] = {0,0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_data1)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1711, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_data2)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1711, __pyx_L3_error)
else {
__Pyx_RaiseArgtupleInvalid("mus_correlate", 1, 2, 2, 1); __PYX_ERR(0, 1711, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "mus_correlate") < 0)) __PYX_ERR(0, 1711, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 2)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
}
__pyx_v_data1 = ((PyArrayObject *)values[0]);
__pyx_v_data2 = ((PyArrayObject *)values[1]);
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("mus_correlate", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 1711, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.mus_correlate", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_data1), __pyx_ptype_5numpy_ndarray, 1, "data1", 0))) __PYX_ERR(0, 1711, __pyx_L1_error)
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_data2), __pyx_ptype_5numpy_ndarray, 1, "data2", 0))) __PYX_ERR(0, 1711, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_116mus_correlate(__pyx_self, __pyx_v_data1, __pyx_v_data2);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_116mus_correlate(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_data1, PyArrayObject *__pyx_v_data2) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = ((PyObject *)__pyx_f_8pysndlib_3clm_mus_correlate(__pyx_v_data1, __pyx_v_data2, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1711, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("pysndlib.clm.mus_correlate", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_117mus_correlate, 0, __pyx_n_s_mus_correlate, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__245)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 1711, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_mus_correlate, __pyx_t_40) < 0) __PYX_ERR(0, 1711, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
/* … */
__pyx_codeobj__245 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__208, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_mus_correlate, 1711, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__245)) __PYX_ERR(0, 1711, __pyx_L1_error)
1712: """
1713: in place cross-correlation of data1 and data2 (both ndarrays).
1714:
1715: :param data1: data 1
1716: :param data2: data 2
1717: :return: correlation result written into data1
1718: :rtype: np.ndarray
1719:
1720:
1721: """
1722:
+1723: size = len(data1)
__pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_data1)); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1723, __pyx_L1_error) __pyx_v_size = __pyx_t_1;
+1724: check_ndim(data1)
__pyx_t_2 = __pyx_f_8pysndlib_3clm_check_ndim(((PyObject *)__pyx_v_data1), 0, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1724, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+1725: check_ndim(data2)
__pyx_t_2 = __pyx_f_8pysndlib_3clm_check_ndim(((PyObject *)__pyx_v_data2), 0, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1725, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+1726: compare_shapes(data1, data2)
__pyx_t_2 = __pyx_f_8pysndlib_3clm_compare_shapes(((PyObject *)__pyx_v_data1), ((PyObject *)__pyx_v_data2), 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1726, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+1727: cdef double [:] data1_view = data1
__pyx_t_3 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(((PyObject *)__pyx_v_data1), PyBUF_WRITABLE); if (unlikely(!__pyx_t_3.memview)) __PYX_ERR(0, 1727, __pyx_L1_error) __pyx_v_data1_view = __pyx_t_3; __pyx_t_3.memview = NULL; __pyx_t_3.data = NULL;
+1728: cdef double [:] data2_view = data2
__pyx_t_3 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(((PyObject *)__pyx_v_data2), PyBUF_WRITABLE); if (unlikely(!__pyx_t_3.memview)) __PYX_ERR(0, 1728, __pyx_L1_error) __pyx_v_data2_view = __pyx_t_3; __pyx_t_3.memview = NULL; __pyx_t_3.data = NULL;
1729:
+1730: cclm.mus_correlate(&data1_view[0], &data2_view[0], size)
__pyx_t_4 = 0;
__pyx_t_5 = -1;
if (__pyx_t_4 < 0) {
__pyx_t_4 += __pyx_v_data1_view.shape[0];
if (unlikely(__pyx_t_4 < 0)) __pyx_t_5 = 0;
} else if (unlikely(__pyx_t_4 >= __pyx_v_data1_view.shape[0])) __pyx_t_5 = 0;
if (unlikely(__pyx_t_5 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_5);
__PYX_ERR(0, 1730, __pyx_L1_error)
}
__pyx_t_6 = 0;
__pyx_t_5 = -1;
if (__pyx_t_6 < 0) {
__pyx_t_6 += __pyx_v_data2_view.shape[0];
if (unlikely(__pyx_t_6 < 0)) __pyx_t_5 = 0;
} else if (unlikely(__pyx_t_6 >= __pyx_v_data2_view.shape[0])) __pyx_t_5 = 0;
if (unlikely(__pyx_t_5 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_5);
__PYX_ERR(0, 1730, __pyx_L1_error)
}
(void)(mus_correlate((&(*((double *) ( /* dim=0 */ (__pyx_v_data1_view.data + __pyx_t_4 * __pyx_v_data1_view.strides[0]) )))), (&(*((double *) ( /* dim=0 */ (__pyx_v_data2_view.data + __pyx_t_6 * __pyx_v_data2_view.strides[0]) )))), __pyx_v_size));
+1731: return data1
__Pyx_XDECREF((PyObject *)__pyx_r); __Pyx_INCREF((PyObject *)__pyx_v_data1); __pyx_r = __pyx_v_data1; goto __pyx_L0;
1732:
1733:
+1734: def correlate(data1: npt.NDArray[np.float64], data2: npt.NDArray[np.float64]):
/* Python wrapper */ static PyObject *__pyx_pw_8pysndlib_3clm_119correlate(PyObject *__pyx_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_118correlate, "\n cross-correlation of data1 and data2 (both ndarrays).\n \n :param data1: data 1\n :param data2: data 2\n :return: correlation result\n :rtype: np.ndarray\n \n \n "); static PyMethodDef __pyx_mdef_8pysndlib_3clm_119correlate = {"correlate", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_119correlate, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_118correlate}; static PyObject *__pyx_pw_8pysndlib_3clm_119correlate(PyObject *__pyx_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { PyObject *__pyx_v_data1 = 0; PyObject *__pyx_v_data2 = 0; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("correlate (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_MACROS __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { PyObject **__pyx_pyargnames[] = {&__pyx_n_s_data1,&__pyx_n_s_data2,0}; PyObject* values[2] = {0,0}; if (__pyx_kwds) { Py_ssize_t kw_args; switch (__pyx_nargs) { case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); CYTHON_FALLTHROUGH; case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); switch (__pyx_nargs) { case 0: if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_data1)) != 0)) { (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); kw_args--; } else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1734, __pyx_L3_error) else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_data2)) != 0)) { (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); kw_args--; } else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1734, __pyx_L3_error) else { __Pyx_RaiseArgtupleInvalid("correlate", 1, 2, 2, 1); __PYX_ERR(0, 1734, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { const Py_ssize_t kwd_pos_args = __pyx_nargs; if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "correlate") < 0)) __PYX_ERR(0, 1734, __pyx_L3_error) } } else if (unlikely(__pyx_nargs != 2)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); } __pyx_v_data1 = values[0]; __pyx_v_data2 = values[1]; } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("correlate", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 1734, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; { Py_ssize_t __pyx_temp; for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); } } __Pyx_AddTraceback("pysndlib.clm.correlate", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_8pysndlib_3clm_118correlate(__pyx_self, __pyx_v_data1, __pyx_v_data2); int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; /* function exit code */ { Py_ssize_t __pyx_temp; for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); } } __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_8pysndlib_3clm_118correlate(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_data1, PyObject *__pyx_v_data2) { Py_ssize_t __pyx_v_size; PyObject *__pyx_v_data1_cpy = NULL; PyObject *__pyx_v_data2_cpy = NULL; __Pyx_memviewslice __pyx_v_data1_view = { 0, 0, { 0 }, { 0 }, { 0 } }; __Pyx_memviewslice __pyx_v_data2_view = { 0, 0, { 0 }, { 0 }, { 0 } }; PyObject *__pyx_r = NULL; /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __PYX_XCLEAR_MEMVIEW(&__pyx_t_6, 1); __Pyx_AddTraceback("pysndlib.clm.correlate", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_data1_cpy); __Pyx_XDECREF(__pyx_v_data2_cpy); __PYX_XCLEAR_MEMVIEW(&__pyx_v_data1_view, 1); __PYX_XCLEAR_MEMVIEW(&__pyx_v_data2_view, 1); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__246 = PyTuple_Pack(7, __pyx_n_s_data1, __pyx_n_s_data2, __pyx_n_s_size, __pyx_n_s_data1_cpy, __pyx_n_s_data2_cpy, __pyx_n_s_data1_view, __pyx_n_s_data2_view); if (unlikely(!__pyx_tuple__246)) __PYX_ERR(0, 1734, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__246); __Pyx_GIVEREF(__pyx_tuple__246); /* … */ __pyx_t_40 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 1734, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_40); if (PyDict_SetItem(__pyx_t_40, __pyx_n_s_data1, __pyx_kp_s_npt_NDArray_np_float64) < 0) __PYX_ERR(0, 1734, __pyx_L1_error) if (PyDict_SetItem(__pyx_t_40, __pyx_n_s_data2, __pyx_kp_s_npt_NDArray_np_float64) < 0) __PYX_ERR(0, 1734, __pyx_L1_error) __pyx_t_43 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_119correlate, 0, __pyx_n_s_correlate, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__247)); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 1734, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_43); __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_43, __pyx_t_40); __Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0; if (PyDict_SetItem(__pyx_d, __pyx_n_s_correlate, __pyx_t_43) < 0) __PYX_ERR(0, 1734, __pyx_L1_error) __Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0; __pyx_codeobj__247 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 7, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__246, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_correlate, 1734, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__247)) __PYX_ERR(0, 1734, __pyx_L1_error)
1735: """
1736: cross-correlation of data1 and data2 (both ndarrays).
1737:
1738: :param data1: data 1
1739: :param data2: data 2
1740: :return: correlation result
1741: :rtype: np.ndarray
1742:
1743:
1744: """
1745:
+1746: size = len(data1)
__pyx_t_1 = PyObject_Length(__pyx_v_data1); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1746, __pyx_L1_error) __pyx_v_size = __pyx_t_1;
+1747: check_ndim(data1)
__pyx_t_2 = __pyx_f_8pysndlib_3clm_check_ndim(__pyx_v_data1, 0, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1747, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+1748: check_ndim(data2)
__pyx_t_2 = __pyx_f_8pysndlib_3clm_check_ndim(__pyx_v_data2, 0, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1748, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+1749: data1_cpy = np.copy(data1)
__Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1749, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_copy); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1749, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = NULL; __pyx_t_5 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_4))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_4, function); __pyx_t_5 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v_data1}; __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1749, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } __pyx_v_data1_cpy = __pyx_t_2; __pyx_t_2 = 0;
+1750: data2_cpy = np.copy(data2)
__Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1750, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_copy); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1750, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = NULL; __pyx_t_5 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_3))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); __pyx_t_5 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v_data2}; __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1750, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } __pyx_v_data2_cpy = __pyx_t_2; __pyx_t_2 = 0;
+1751: compare_shapes(data1, data2)
__pyx_t_2 = __pyx_f_8pysndlib_3clm_compare_shapes(__pyx_v_data1, __pyx_v_data2, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1751, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+1752: cdef double [:] data1_view = data1_cpy
__pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_v_data1_cpy, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 1752, __pyx_L1_error) __pyx_v_data1_view = __pyx_t_6; __pyx_t_6.memview = NULL; __pyx_t_6.data = NULL;
+1753: cdef double [:] data2_view = data2_cpy
__pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_v_data2_cpy, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 1753, __pyx_L1_error) __pyx_v_data2_view = __pyx_t_6; __pyx_t_6.memview = NULL; __pyx_t_6.data = NULL;
1754:
+1755: cclm.mus_correlate(&data1_view[0], &data2_view[0], size)
__pyx_t_7 = 0;
__pyx_t_5 = -1;
if (__pyx_t_7 < 0) {
__pyx_t_7 += __pyx_v_data1_view.shape[0];
if (unlikely(__pyx_t_7 < 0)) __pyx_t_5 = 0;
} else if (unlikely(__pyx_t_7 >= __pyx_v_data1_view.shape[0])) __pyx_t_5 = 0;
if (unlikely(__pyx_t_5 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_5);
__PYX_ERR(0, 1755, __pyx_L1_error)
}
__pyx_t_8 = 0;
__pyx_t_5 = -1;
if (__pyx_t_8 < 0) {
__pyx_t_8 += __pyx_v_data2_view.shape[0];
if (unlikely(__pyx_t_8 < 0)) __pyx_t_5 = 0;
} else if (unlikely(__pyx_t_8 >= __pyx_v_data2_view.shape[0])) __pyx_t_5 = 0;
if (unlikely(__pyx_t_5 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_5);
__PYX_ERR(0, 1755, __pyx_L1_error)
}
(void)(mus_correlate((&(*((double *) ( /* dim=0 */ (__pyx_v_data1_view.data + __pyx_t_7 * __pyx_v_data1_view.strides[0]) )))), (&(*((double *) ( /* dim=0 */ (__pyx_v_data2_view.data + __pyx_t_8 * __pyx_v_data2_view.strides[0]) )))), __pyx_v_size));
+1756: return data1_cpy
__Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_v_data1_cpy); __pyx_r = __pyx_v_data1_cpy; goto __pyx_L0;
1757:
+1758: cpdef np.ndarray mus_cepstrum( np.ndarray data):
static PyObject *__pyx_pw_8pysndlib_3clm_121mus_cepstrum(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyArrayObject *__pyx_f_8pysndlib_3clm_mus_cepstrum(PyArrayObject *__pyx_v_data, CYTHON_UNUSED int __pyx_skip_dispatch) {
Py_ssize_t __pyx_v_size;
__Pyx_memviewslice __pyx_v_data_view = { 0, 0, { 0 }, { 0 }, { 0 } };
PyArrayObject *__pyx_r = NULL;
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__PYX_XCLEAR_MEMVIEW(&__pyx_t_3, 1);
__Pyx_AddTraceback("pysndlib.clm.mus_cepstrum", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__PYX_XCLEAR_MEMVIEW(&__pyx_v_data_view, 1);
__Pyx_XGIVEREF((PyObject *)__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_121mus_cepstrum(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_120mus_cepstrum, "\n return cepstrum of signal\n \n :param data: samples to analyze\n :return: cepstrum. also written into data\n :rtype: np.ndarray\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_121mus_cepstrum = {"mus_cepstrum", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_121mus_cepstrum, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_120mus_cepstrum};
static PyObject *__pyx_pw_8pysndlib_3clm_121mus_cepstrum(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
PyArrayObject *__pyx_v_data = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("mus_cepstrum (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_data,0};
PyObject* values[1] = {0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_data)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1758, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "mus_cepstrum") < 0)) __PYX_ERR(0, 1758, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 1)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
}
__pyx_v_data = ((PyArrayObject *)values[0]);
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("mus_cepstrum", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 1758, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.mus_cepstrum", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_data), __pyx_ptype_5numpy_ndarray, 1, "data", 0))) __PYX_ERR(0, 1758, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_120mus_cepstrum(__pyx_self, __pyx_v_data);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_120mus_cepstrum(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_data) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = ((PyObject *)__pyx_f_8pysndlib_3clm_mus_cepstrum(__pyx_v_data, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1758, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("pysndlib.clm.mus_cepstrum", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_43 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_121mus_cepstrum, 0, __pyx_n_s_mus_cepstrum, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__248)); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 1758, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_mus_cepstrum, __pyx_t_43) < 0) __PYX_ERR(0, 1758, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
/* … */
__pyx_codeobj__248 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__241, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_mus_cepstrum, 1758, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__248)) __PYX_ERR(0, 1758, __pyx_L1_error)
1759: """
1760: return cepstrum of signal
1761:
1762: :param data: samples to analyze
1763: :return: cepstrum. also written into data
1764: :rtype: np.ndarray
1765: """
+1766: size = len(data)
__pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_data)); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1766, __pyx_L1_error) __pyx_v_size = __pyx_t_1;
+1767: check_ndim(data)
__pyx_t_2 = __pyx_f_8pysndlib_3clm_check_ndim(((PyObject *)__pyx_v_data), 0, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1767, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+1768: cdef double [:] data_view = data
__pyx_t_3 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(((PyObject *)__pyx_v_data), PyBUF_WRITABLE); if (unlikely(!__pyx_t_3.memview)) __PYX_ERR(0, 1768, __pyx_L1_error) __pyx_v_data_view = __pyx_t_3; __pyx_t_3.memview = NULL; __pyx_t_3.data = NULL;
+1769: cclm.mus_cepstrum(&data_view[0], size)
__pyx_t_4 = 0;
__pyx_t_5 = -1;
if (__pyx_t_4 < 0) {
__pyx_t_4 += __pyx_v_data_view.shape[0];
if (unlikely(__pyx_t_4 < 0)) __pyx_t_5 = 0;
} else if (unlikely(__pyx_t_4 >= __pyx_v_data_view.shape[0])) __pyx_t_5 = 0;
if (unlikely(__pyx_t_5 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_5);
__PYX_ERR(0, 1769, __pyx_L1_error)
}
(void)(mus_cepstrum((&(*((double *) ( /* dim=0 */ (__pyx_v_data_view.data + __pyx_t_4 * __pyx_v_data_view.strides[0]) )))), __pyx_v_size));
+1770: return data
__Pyx_XDECREF((PyObject *)__pyx_r); __Pyx_INCREF((PyObject *)__pyx_v_data); __pyx_r = __pyx_v_data; goto __pyx_L0;
1771:
+1772: def cepstrum(data: npt.NDArray[np.float64]):
/* Python wrapper */ static PyObject *__pyx_pw_8pysndlib_3clm_123cepstrum(PyObject *__pyx_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_122cepstrum, "\n return cepstrum of signal\n \n :param data: samples to analyze\n :return: cepstrum.\n :rtype: np.ndarray\n "); static PyMethodDef __pyx_mdef_8pysndlib_3clm_123cepstrum = {"cepstrum", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_123cepstrum, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_122cepstrum}; static PyObject *__pyx_pw_8pysndlib_3clm_123cepstrum(PyObject *__pyx_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { PyObject *__pyx_v_data = 0; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("cepstrum (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_MACROS __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { PyObject **__pyx_pyargnames[] = {&__pyx_n_s_data,0}; PyObject* values[1] = {0}; if (__pyx_kwds) { Py_ssize_t kw_args; switch (__pyx_nargs) { case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); switch (__pyx_nargs) { case 0: if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_data)) != 0)) { (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); kw_args--; } else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1772, __pyx_L3_error) else goto __pyx_L5_argtuple_error; } if (unlikely(kw_args > 0)) { const Py_ssize_t kwd_pos_args = __pyx_nargs; if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "cepstrum") < 0)) __PYX_ERR(0, 1772, __pyx_L3_error) } } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); } __pyx_v_data = values[0]; } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("cepstrum", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 1772, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; { Py_ssize_t __pyx_temp; for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); } } __Pyx_AddTraceback("pysndlib.clm.cepstrum", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_8pysndlib_3clm_122cepstrum(__pyx_self, __pyx_v_data); int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; /* function exit code */ { Py_ssize_t __pyx_temp; for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); } } __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_8pysndlib_3clm_122cepstrum(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_data) { Py_ssize_t __pyx_v_size; PyObject *__pyx_v_data_cpy = NULL; __Pyx_memviewslice __pyx_v_data_view = { 0, 0, { 0 }, { 0 }, { 0 } }; PyObject *__pyx_r = NULL; /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __PYX_XCLEAR_MEMVIEW(&__pyx_t_6, 1); __Pyx_AddTraceback("pysndlib.clm.cepstrum", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_data_cpy); __PYX_XCLEAR_MEMVIEW(&__pyx_v_data_view, 1); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_t_43 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 1772, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_43); if (PyDict_SetItem(__pyx_t_43, __pyx_n_s_data, __pyx_kp_s_npt_NDArray_np_float64) < 0) __PYX_ERR(0, 1772, __pyx_L1_error) __pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_123cepstrum, 0, __pyx_n_s_cepstrum, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__249)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 1772, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_40); __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_40, __pyx_t_43); __Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0; if (PyDict_SetItem(__pyx_d, __pyx_n_s_cepstrum, __pyx_t_40) < 0) __PYX_ERR(0, 1772, __pyx_L1_error) __Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0; /* … */ __pyx_codeobj__249 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__243, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_cepstrum, 1772, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__249)) __PYX_ERR(0, 1772, __pyx_L1_error)
1773: """
1774: return cepstrum of signal
1775:
1776: :param data: samples to analyze
1777: :return: cepstrum.
1778: :rtype: np.ndarray
1779: """
+1780: size = len(data)
__pyx_t_1 = PyObject_Length(__pyx_v_data); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1780, __pyx_L1_error) __pyx_v_size = __pyx_t_1;
+1781: check_ndim(data)
__pyx_t_2 = __pyx_f_8pysndlib_3clm_check_ndim(__pyx_v_data, 0, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1781, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+1782: data_cpy = np.copy(data)
__Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1782, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_copy); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1782, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = NULL; __pyx_t_5 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_4))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_4, function); __pyx_t_5 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v_data}; __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1782, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } __pyx_v_data_cpy = __pyx_t_2; __pyx_t_2 = 0;
+1783: cdef double [:] data_view = data_cpy
__pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_v_data_cpy, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 1783, __pyx_L1_error) __pyx_v_data_view = __pyx_t_6; __pyx_t_6.memview = NULL; __pyx_t_6.data = NULL;
+1784: cclm.mus_cepstrum(&data_view[0], size)
__pyx_t_7 = 0;
__pyx_t_5 = -1;
if (__pyx_t_7 < 0) {
__pyx_t_7 += __pyx_v_data_view.shape[0];
if (unlikely(__pyx_t_7 < 0)) __pyx_t_5 = 0;
} else if (unlikely(__pyx_t_7 >= __pyx_v_data_view.shape[0])) __pyx_t_5 = 0;
if (unlikely(__pyx_t_5 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_5);
__PYX_ERR(0, 1784, __pyx_L1_error)
}
(void)(mus_cepstrum((&(*((double *) ( /* dim=0 */ (__pyx_v_data_view.data + __pyx_t_7 * __pyx_v_data_view.strides[0]) )))), __pyx_v_size));
+1785: return data_cpy
__Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_v_data_cpy); __pyx_r = __pyx_v_data_cpy; goto __pyx_L0;
1786:
+1787: cpdef np.ndarray partials2wave(partials, np.ndarray wave=None, table_size=None, bint norm=True ):
static PyObject *__pyx_pw_8pysndlib_3clm_125partials2wave(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyArrayObject *__pyx_f_8pysndlib_3clm_partials2wave(PyObject *__pyx_v_partials, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_8pysndlib_3clm_partials2wave *__pyx_optional_args) {
PyArrayObject *__pyx_v_wave = ((PyArrayObject *)Py_None);
PyObject *__pyx_v_table_size = ((PyObject *)Py_None);
int __pyx_v_norm = ((int)1);
__Pyx_memviewslice __pyx_v_wave_view = { 0, 0, { 0 }, { 0 }, { 0 } };
__Pyx_memviewslice __pyx_v_partials_view = { 0, 0, { 0 }, { 0 }, { 0 } };
PyArrayObject *__pyx_r = NULL;
if (__pyx_optional_args) {
if (__pyx_optional_args->__pyx_n > 0) {
__pyx_v_wave = __pyx_optional_args->wave;
if (__pyx_optional_args->__pyx_n > 1) {
__pyx_v_table_size = __pyx_optional_args->table_size;
if (__pyx_optional_args->__pyx_n > 2) {
__pyx_v_norm = __pyx_optional_args->norm;
}
}
}
}
__Pyx_INCREF(__pyx_v_partials);
__Pyx_INCREF((PyObject *)__pyx_v_wave);
__Pyx_INCREF(__pyx_v_table_size);
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_XDECREF(__pyx_t_5);
__Pyx_XDECREF(__pyx_t_6);
__PYX_XCLEAR_MEMVIEW(&__pyx_t_10, 1);
__Pyx_AddTraceback("pysndlib.clm.partials2wave", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__PYX_XCLEAR_MEMVIEW(&__pyx_v_wave_view, 1);
__PYX_XCLEAR_MEMVIEW(&__pyx_v_partials_view, 1);
__Pyx_XDECREF(__pyx_v_partials);
__Pyx_XDECREF((PyObject *)__pyx_v_wave);
__Pyx_XDECREF(__pyx_v_table_size);
__Pyx_XGIVEREF((PyObject *)__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_125partials2wave(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_124partials2wave, "\n take a list or np.ndarray of partials (harmonic number and associated amplitude) and produce a\n waveform for use in table_lookup.\n \n :param partials: list or np.ndarray of partials (harm and amp)\n :param wave: array to write wave into. if not provided, one will be allocated\n :param table_size: size of table\n :param norm: whether to normalize partials\n :return: array provided in wave or new array.\n :rtype: np.ndarray\n \n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_125partials2wave = {"partials2wave", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_125partials2wave, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_124partials2wave};
static PyObject *__pyx_pw_8pysndlib_3clm_125partials2wave(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
PyObject *__pyx_v_partials = 0;
PyArrayObject *__pyx_v_wave = 0;
PyObject *__pyx_v_table_size = 0;
int __pyx_v_norm;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("partials2wave (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_partials,&__pyx_n_s_wave,&__pyx_n_s_table_size,&__pyx_n_s_norm,0};
PyObject* values[4] = {0,0,0,0};
values[1] = __Pyx_Arg_NewRef_FASTCALL((PyObject *)((PyArrayObject *)Py_None));
values[2] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
CYTHON_FALLTHROUGH;
case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_partials)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1787, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_wave);
if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1787, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 2:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_table_size);
if (value) { values[2] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1787, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 3:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_norm);
if (value) { values[3] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1787, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "partials2wave") < 0)) __PYX_ERR(0, 1787, __pyx_L3_error)
}
} else {
switch (__pyx_nargs) {
case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
CYTHON_FALLTHROUGH;
case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
break;
default: goto __pyx_L5_argtuple_error;
}
}
__pyx_v_partials = values[0];
__pyx_v_wave = ((PyArrayObject *)values[1]);
__pyx_v_table_size = values[2];
if (values[3]) {
__pyx_v_norm = __Pyx_PyObject_IsTrue(values[3]); if (unlikely((__pyx_v_norm == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1787, __pyx_L3_error)
} else {
__pyx_v_norm = ((int)1);
}
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("partials2wave", 0, 1, 4, __pyx_nargs); __PYX_ERR(0, 1787, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.partials2wave", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_wave), __pyx_ptype_5numpy_ndarray, 1, "wave", 0))) __PYX_ERR(0, 1787, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_124partials2wave(__pyx_self, __pyx_v_partials, __pyx_v_wave, __pyx_v_table_size, __pyx_v_norm);
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_124partials2wave(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_partials, PyArrayObject *__pyx_v_wave, PyObject *__pyx_v_table_size, int __pyx_v_norm) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_2.__pyx_n = 3;
__pyx_t_2.wave = __pyx_v_wave;
__pyx_t_2.table_size = __pyx_v_table_size;
__pyx_t_2.norm = __pyx_v_norm;
__pyx_t_1 = ((PyObject *)__pyx_f_8pysndlib_3clm_partials2wave(__pyx_v_partials, 0, &__pyx_t_2)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1787, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("pysndlib.clm.partials2wave", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_tuple__250 = PyTuple_Pack(4, __pyx_n_s_partials, __pyx_n_s_wave, __pyx_n_s_table_size, __pyx_n_s_norm); if (unlikely(!__pyx_tuple__250)) __PYX_ERR(0, 1787, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__250);
__Pyx_GIVEREF(__pyx_tuple__250);
__pyx_codeobj__251 = (PyObject*)__Pyx_PyCode_New(4, 0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__250, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_partials2wave, 1787, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__251)) __PYX_ERR(0, 1787, __pyx_L1_error)
/* … */
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_125partials2wave, 0, __pyx_n_s_partials2wave, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__251)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 1787, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
__Pyx_CyFunction_SetDefaultsTuple(__pyx_t_40, __pyx_tuple__252);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_partials2wave, __pyx_t_40) < 0) __PYX_ERR(0, 1787, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
__pyx_tuple__252 = PyTuple_Pack(3, Py_None, Py_None, Py_True); if (unlikely(!__pyx_tuple__252)) __PYX_ERR(0, 1787, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__252);
__Pyx_GIVEREF(__pyx_tuple__252);
1788: """
1789: take a list or np.ndarray of partials (harmonic number and associated amplitude) and produce a
1790: waveform for use in table_lookup.
1791:
1792: :param partials: list or np.ndarray of partials (harm and amp)
1793: :param wave: array to write wave into. if not provided, one will be allocated
1794: :param table_size: size of table
1795: :param norm: whether to normalize partials
1796: :return: array provided in wave or new array.
1797: :rtype: np.ndarray
1798:
1799: """
1800:
+1801: if isinstance(partials, list):
__pyx_t_1 = PyList_Check(__pyx_v_partials);
if (__pyx_t_1) {
/* … */
}
+1802: partials = np.array(partials, dtype=np.double)
__Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1802, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_array); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1802, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1802, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_v_partials); __Pyx_GIVEREF(__pyx_v_partials); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_partials)) __PYX_ERR(0, 1802, __pyx_L1_error); __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1802, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1802, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_double); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1802, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_dtype, __pyx_t_6) < 0) __PYX_ERR(0, 1802, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_2, __pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1802, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF_SET(__pyx_v_partials, __pyx_t_6); __pyx_t_6 = 0;
1803:
+1804: if isinstance(wave, list):
__pyx_t_1 = PyList_Check(((PyObject *)__pyx_v_wave));
if (__pyx_t_1) {
/* … */
}
+1805: wave = np.array(wave, dtype=np.double)
__Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1805, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_array); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1805, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1805, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_INCREF((PyObject *)__pyx_v_wave); __Pyx_GIVEREF((PyObject *)__pyx_v_wave); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_v_wave))) __PYX_ERR(0, 1805, __pyx_L1_error); __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1805, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1805, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_double); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1805, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_dtype, __pyx_t_5) < 0) __PYX_ERR(0, 1805, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_6, __pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1805, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1805, __pyx_L1_error) __Pyx_DECREF_SET(__pyx_v_wave, ((PyArrayObject *)__pyx_t_5)); __pyx_t_5 = 0;
1806:
+1807: if not wave:
__pyx_t_1 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_wave)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 1807, __pyx_L1_error) __pyx_t_7 = (!__pyx_t_1); if (__pyx_t_7) { /* … */ goto __pyx_L5; }
+1808: if table_size is not None:
__pyx_t_7 = (__pyx_v_table_size != Py_None);
if (__pyx_t_7) {
/* … */
goto __pyx_L6;
}
+1809: wave = np.zeros(table_size)
__Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1809, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1809, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = NULL; __pyx_t_8 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_6))) { __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_6); if (likely(__pyx_t_2)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); __Pyx_INCREF(__pyx_t_2); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_6, function); __pyx_t_8 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_v_table_size}; __pyx_t_5 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+1-__pyx_t_8, 1+__pyx_t_8); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1809, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; } if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1809, __pyx_L1_error) __Pyx_DECREF_SET(__pyx_v_wave, ((PyArrayObject *)__pyx_t_5)); __pyx_t_5 = 0;
1810: else:
+1811: table_size = CLM.table_size
/*else*/ {
__Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_CLM); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1811, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_5);
__pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_table_size); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1811, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_6);
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_DECREF_SET(__pyx_v_table_size, __pyx_t_6);
__pyx_t_6 = 0;
+1812: wave = np.zeros(CLM.table_size)
__Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1812, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_zeros); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1812, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_CLM); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1812, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_table_size); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1812, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_5 = NULL; __pyx_t_8 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_2))) { __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_5)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_5); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); __pyx_t_8 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_t_4}; __pyx_t_6 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_8, 1+__pyx_t_8); __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1812, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1812, __pyx_L1_error) __Pyx_DECREF_SET(__pyx_v_wave, ((PyArrayObject *)__pyx_t_6)); __pyx_t_6 = 0; } __pyx_L6:;
1813: else:
+1814: table_size = len(wave)
/*else*/ {
__pyx_t_9 = PyObject_Length(((PyObject *)__pyx_v_wave)); if (unlikely(__pyx_t_9 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1814, __pyx_L1_error)
__pyx_t_6 = PyInt_FromSsize_t(__pyx_t_9); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1814, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_6);
__Pyx_DECREF_SET(__pyx_v_table_size, __pyx_t_6);
__pyx_t_6 = 0;
}
__pyx_L5:;
1815:
+1816: check_ndim(partials)
__pyx_t_6 = __pyx_f_8pysndlib_3clm_check_ndim(__pyx_v_partials, 0, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1816, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+1817: check_ndim(wave)
__pyx_t_6 = __pyx_f_8pysndlib_3clm_check_ndim(((PyObject *)__pyx_v_wave), 0, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1817, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
1818:
+1819: cdef double [:] wave_view = wave
__pyx_t_10 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(((PyObject *)__pyx_v_wave), PyBUF_WRITABLE); if (unlikely(!__pyx_t_10.memview)) __PYX_ERR(0, 1819, __pyx_L1_error) __pyx_v_wave_view = __pyx_t_10; __pyx_t_10.memview = NULL; __pyx_t_10.data = NULL;
+1820: cdef double [:] partials_view = partials
__pyx_t_10 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_v_partials, PyBUF_WRITABLE); if (unlikely(!__pyx_t_10.memview)) __PYX_ERR(0, 1820, __pyx_L1_error) __pyx_v_partials_view = __pyx_t_10; __pyx_t_10.memview = NULL; __pyx_t_10.data = NULL;
1821:
+1822: cclm.mus_partials_to_wave(&partials_view[0], len(partials) // 2, &wave_view[0], table_size, norm)
__pyx_t_11 = 0;
__pyx_t_8 = -1;
if (__pyx_t_11 < 0) {
__pyx_t_11 += __pyx_v_partials_view.shape[0];
if (unlikely(__pyx_t_11 < 0)) __pyx_t_8 = 0;
} else if (unlikely(__pyx_t_11 >= __pyx_v_partials_view.shape[0])) __pyx_t_8 = 0;
if (unlikely(__pyx_t_8 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_8);
__PYX_ERR(0, 1822, __pyx_L1_error)
}
__pyx_t_9 = PyObject_Length(__pyx_v_partials); if (unlikely(__pyx_t_9 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1822, __pyx_L1_error)
__pyx_t_12 = 0;
__pyx_t_8 = -1;
if (__pyx_t_12 < 0) {
__pyx_t_12 += __pyx_v_wave_view.shape[0];
if (unlikely(__pyx_t_12 < 0)) __pyx_t_8 = 0;
} else if (unlikely(__pyx_t_12 >= __pyx_v_wave_view.shape[0])) __pyx_t_8 = 0;
if (unlikely(__pyx_t_8 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_8);
__PYX_ERR(0, 1822, __pyx_L1_error)
}
__pyx_t_13 = __Pyx_PyInt_As_int64_t(__pyx_v_table_size); if (unlikely((__pyx_t_13 == ((mus_long_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1822, __pyx_L1_error)
(void)(mus_partials_to_wave((&(*((double *) ( /* dim=0 */ (__pyx_v_partials_view.data + __pyx_t_11 * __pyx_v_partials_view.strides[0]) )))), __Pyx_div_Py_ssize_t(__pyx_t_9, 2), (&(*((double *) ( /* dim=0 */ (__pyx_v_wave_view.data + __pyx_t_12 * __pyx_v_wave_view.strides[0]) )))), __pyx_t_13, __pyx_v_norm));
+1823: return wave
__Pyx_XDECREF((PyObject *)__pyx_r); __Pyx_INCREF((PyObject *)__pyx_v_wave); __pyx_r = __pyx_v_wave; goto __pyx_L0;
1824:
+1825: cpdef np.ndarray phase_partials2wave(partials, np.ndarray wave=None, table_size=None, bint norm=True ):
static PyObject *__pyx_pw_8pysndlib_3clm_127phase_partials2wave(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyArrayObject *__pyx_f_8pysndlib_3clm_phase_partials2wave(PyObject *__pyx_v_partials, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_8pysndlib_3clm_phase_partials2wave *__pyx_optional_args) {
PyArrayObject *__pyx_v_wave = ((PyArrayObject *)Py_None);
PyObject *__pyx_v_table_size = ((PyObject *)Py_None);
int __pyx_v_norm = ((int)1);
__Pyx_memviewslice __pyx_v_wave_view = { 0, 0, { 0 }, { 0 }, { 0 } };
__Pyx_memviewslice __pyx_v_partials_view = { 0, 0, { 0 }, { 0 }, { 0 } };
PyArrayObject *__pyx_r = NULL;
if (__pyx_optional_args) {
if (__pyx_optional_args->__pyx_n > 0) {
__pyx_v_wave = __pyx_optional_args->wave;
if (__pyx_optional_args->__pyx_n > 1) {
__pyx_v_table_size = __pyx_optional_args->table_size;
if (__pyx_optional_args->__pyx_n > 2) {
__pyx_v_norm = __pyx_optional_args->norm;
}
}
}
}
__Pyx_INCREF(__pyx_v_partials);
__Pyx_INCREF((PyObject *)__pyx_v_wave);
__Pyx_INCREF(__pyx_v_table_size);
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_XDECREF(__pyx_t_5);
__Pyx_XDECREF(__pyx_t_6);
__PYX_XCLEAR_MEMVIEW(&__pyx_t_9, 1);
__Pyx_AddTraceback("pysndlib.clm.phase_partials2wave", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__PYX_XCLEAR_MEMVIEW(&__pyx_v_wave_view, 1);
__PYX_XCLEAR_MEMVIEW(&__pyx_v_partials_view, 1);
__Pyx_XDECREF(__pyx_v_partials);
__Pyx_XDECREF((PyObject *)__pyx_v_wave);
__Pyx_XDECREF(__pyx_v_table_size);
__Pyx_XGIVEREF((PyObject *)__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_127phase_partials2wave(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_126phase_partials2wave, "\n take a list of partials (harmonic number, amplitude, initial phase) and produce a waveform for use\n in table_lookup.\n \n :param partials: list or np.ndarray of partials (harm, amp, phase)\n :param wave: array to write wave into. if not provided, one will be allocated\n :param table_size: size of table\n :param norm: whether to normalize partials\n :return: array provided in wave or new array.\n :rtype: np.ndarray\n \n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_127phase_partials2wave = {"phase_partials2wave", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_127phase_partials2wave, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_126phase_partials2wave};
static PyObject *__pyx_pw_8pysndlib_3clm_127phase_partials2wave(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
PyObject *__pyx_v_partials = 0;
PyArrayObject *__pyx_v_wave = 0;
PyObject *__pyx_v_table_size = 0;
int __pyx_v_norm;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("phase_partials2wave (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_partials,&__pyx_n_s_wave,&__pyx_n_s_table_size,&__pyx_n_s_norm,0};
PyObject* values[4] = {0,0,0,0};
values[1] = __Pyx_Arg_NewRef_FASTCALL((PyObject *)((PyArrayObject *)Py_None));
values[2] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
CYTHON_FALLTHROUGH;
case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_partials)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1825, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_wave);
if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1825, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 2:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_table_size);
if (value) { values[2] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1825, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 3:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_norm);
if (value) { values[3] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1825, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "phase_partials2wave") < 0)) __PYX_ERR(0, 1825, __pyx_L3_error)
}
} else {
switch (__pyx_nargs) {
case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
CYTHON_FALLTHROUGH;
case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
break;
default: goto __pyx_L5_argtuple_error;
}
}
__pyx_v_partials = values[0];
__pyx_v_wave = ((PyArrayObject *)values[1]);
__pyx_v_table_size = values[2];
if (values[3]) {
__pyx_v_norm = __Pyx_PyObject_IsTrue(values[3]); if (unlikely((__pyx_v_norm == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1825, __pyx_L3_error)
} else {
__pyx_v_norm = ((int)1);
}
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("phase_partials2wave", 0, 1, 4, __pyx_nargs); __PYX_ERR(0, 1825, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.phase_partials2wave", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_wave), __pyx_ptype_5numpy_ndarray, 1, "wave", 0))) __PYX_ERR(0, 1825, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_126phase_partials2wave(__pyx_self, __pyx_v_partials, __pyx_v_wave, __pyx_v_table_size, __pyx_v_norm);
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_126phase_partials2wave(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_partials, PyArrayObject *__pyx_v_wave, PyObject *__pyx_v_table_size, int __pyx_v_norm) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_2.__pyx_n = 3;
__pyx_t_2.wave = __pyx_v_wave;
__pyx_t_2.table_size = __pyx_v_table_size;
__pyx_t_2.norm = __pyx_v_norm;
__pyx_t_1 = ((PyObject *)__pyx_f_8pysndlib_3clm_phase_partials2wave(__pyx_v_partials, 0, &__pyx_t_2)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1825, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("pysndlib.clm.phase_partials2wave", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_codeobj__253 = (PyObject*)__Pyx_PyCode_New(4, 0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__250, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_phase_partials2wave, 1825, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__253)) __PYX_ERR(0, 1825, __pyx_L1_error)
/* … */
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_127phase_partials2wave, 0, __pyx_n_s_phase_partials2wave, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__253)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 1825, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
__Pyx_CyFunction_SetDefaultsTuple(__pyx_t_40, __pyx_tuple__254);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_phase_partials2wave, __pyx_t_40) < 0) __PYX_ERR(0, 1825, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
__pyx_tuple__254 = PyTuple_Pack(3, Py_None, Py_None, Py_True); if (unlikely(!__pyx_tuple__254)) __PYX_ERR(0, 1825, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__254);
__Pyx_GIVEREF(__pyx_tuple__254);
1826: """
1827: take a list of partials (harmonic number, amplitude, initial phase) and produce a waveform for use
1828: in table_lookup.
1829:
1830: :param partials: list or np.ndarray of partials (harm, amp, phase)
1831: :param wave: array to write wave into. if not provided, one will be allocated
1832: :param table_size: size of table
1833: :param norm: whether to normalize partials
1834: :return: array provided in wave or new array.
1835: :rtype: np.ndarray
1836:
1837: """
1838:
+1839: if isinstance(partials, list):
__pyx_t_1 = PyList_Check(__pyx_v_partials);
if (__pyx_t_1) {
/* … */
}
+1840: partials = np.array(partials, dtype=np.double)
__Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1840, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_array); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1840, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1840, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_v_partials); __Pyx_GIVEREF(__pyx_v_partials); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_partials)) __PYX_ERR(0, 1840, __pyx_L1_error); __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1840, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1840, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_double); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1840, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_dtype, __pyx_t_6) < 0) __PYX_ERR(0, 1840, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_2, __pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1840, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF_SET(__pyx_v_partials, __pyx_t_6); __pyx_t_6 = 0;
1841:
+1842: if wave is None:
__pyx_t_1 = (((PyObject *)__pyx_v_wave) == Py_None);
if (__pyx_t_1) {
/* … */
goto __pyx_L4;
}
+1843: if table_size:
__pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_table_size); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 1843, __pyx_L1_error) if (__pyx_t_1) { /* … */ goto __pyx_L5; }
+1844: wave = np.zeros(table_size)
__Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1844, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_zeros); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1844, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = NULL; __pyx_t_7 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_2))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); __pyx_t_7 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v_table_size}; __pyx_t_6 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1844, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1844, __pyx_L1_error) __Pyx_DECREF_SET(__pyx_v_wave, ((PyArrayObject *)__pyx_t_6)); __pyx_t_6 = 0;
1845: else:
+1846: wave = np.zeros(CLM.table_size)
/*else*/ {
__Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1846, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1846, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_CLM); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1846, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_table_size); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1846, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_t_2 = NULL;
__pyx_t_7 = 0;
#if CYTHON_UNPACK_METHODS
if (unlikely(PyMethod_Check(__pyx_t_4))) {
__pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4);
if (likely(__pyx_t_2)) {
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
__Pyx_INCREF(__pyx_t_2);
__Pyx_INCREF(function);
__Pyx_DECREF_SET(__pyx_t_4, function);
__pyx_t_7 = 1;
}
}
#endif
{
PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_3};
__pyx_t_6 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7);
__Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1846, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_6);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
}
if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1846, __pyx_L1_error)
__Pyx_DECREF_SET(__pyx_v_wave, ((PyArrayObject *)__pyx_t_6));
__pyx_t_6 = 0;
}
__pyx_L5:;
1847: else:
+1848: table_size = len(wave)
/*else*/ {
__pyx_t_8 = PyObject_Length(((PyObject *)__pyx_v_wave)); if (unlikely(__pyx_t_8 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1848, __pyx_L1_error)
__pyx_t_6 = PyInt_FromSsize_t(__pyx_t_8); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1848, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_6);
__Pyx_DECREF_SET(__pyx_v_table_size, __pyx_t_6);
__pyx_t_6 = 0;
}
__pyx_L4:;
1849:
+1850: check_ndim(wave)
__pyx_t_6 = __pyx_f_8pysndlib_3clm_check_ndim(((PyObject *)__pyx_v_wave), 0, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1850, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+1851: check_ndim(partials)
__pyx_t_6 = __pyx_f_8pysndlib_3clm_check_ndim(__pyx_v_partials, 0, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1851, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
1852:
+1853: cdef double [:] wave_view = wave
__pyx_t_9 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(((PyObject *)__pyx_v_wave), PyBUF_WRITABLE); if (unlikely(!__pyx_t_9.memview)) __PYX_ERR(0, 1853, __pyx_L1_error) __pyx_v_wave_view = __pyx_t_9; __pyx_t_9.memview = NULL; __pyx_t_9.data = NULL;
+1854: cdef double [:] partials_view = partials
__pyx_t_9 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_v_partials, PyBUF_WRITABLE); if (unlikely(!__pyx_t_9.memview)) __PYX_ERR(0, 1854, __pyx_L1_error) __pyx_v_partials_view = __pyx_t_9; __pyx_t_9.memview = NULL; __pyx_t_9.data = NULL;
1855:
+1856: cclm.mus_partials_to_wave(&partials_view[0], len(partials) // 3, &wave_view[0], table_size, norm)
__pyx_t_10 = 0;
__pyx_t_7 = -1;
if (__pyx_t_10 < 0) {
__pyx_t_10 += __pyx_v_partials_view.shape[0];
if (unlikely(__pyx_t_10 < 0)) __pyx_t_7 = 0;
} else if (unlikely(__pyx_t_10 >= __pyx_v_partials_view.shape[0])) __pyx_t_7 = 0;
if (unlikely(__pyx_t_7 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_7);
__PYX_ERR(0, 1856, __pyx_L1_error)
}
__pyx_t_8 = PyObject_Length(__pyx_v_partials); if (unlikely(__pyx_t_8 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1856, __pyx_L1_error)
__pyx_t_11 = 0;
__pyx_t_7 = -1;
if (__pyx_t_11 < 0) {
__pyx_t_11 += __pyx_v_wave_view.shape[0];
if (unlikely(__pyx_t_11 < 0)) __pyx_t_7 = 0;
} else if (unlikely(__pyx_t_11 >= __pyx_v_wave_view.shape[0])) __pyx_t_7 = 0;
if (unlikely(__pyx_t_7 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_7);
__PYX_ERR(0, 1856, __pyx_L1_error)
}
__pyx_t_12 = __Pyx_PyInt_As_int64_t(__pyx_v_table_size); if (unlikely((__pyx_t_12 == ((mus_long_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1856, __pyx_L1_error)
(void)(mus_partials_to_wave((&(*((double *) ( /* dim=0 */ (__pyx_v_partials_view.data + __pyx_t_10 * __pyx_v_partials_view.strides[0]) )))), __Pyx_div_Py_ssize_t(__pyx_t_8, 3), (&(*((double *) ( /* dim=0 */ (__pyx_v_wave_view.data + __pyx_t_11 * __pyx_v_wave_view.strides[0]) )))), __pyx_t_12, __pyx_v_norm));
+1857: return wave
__Pyx_XDECREF((PyObject *)__pyx_r); __Pyx_INCREF((PyObject *)__pyx_v_wave); __pyx_r = __pyx_v_wave; goto __pyx_L0;
1858:
+1859: cpdef np.ndarray partials2polynomial(partials, Polynomial kind=Polynomial.FIRST_KIND):
static PyObject *__pyx_pw_8pysndlib_3clm_129partials2polynomial(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyArrayObject *__pyx_f_8pysndlib_3clm_partials2polynomial(PyObject *__pyx_v_partials, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_8pysndlib_3clm_partials2polynomial *__pyx_optional_args) {
enum __pyx_t_8pysndlib_3clm_Polynomial __pyx_v_kind = __pyx_k__29;
PyArrayObject *__pyx_v_p = NULL;
__Pyx_memviewslice __pyx_v_p_view = { 0, 0, { 0 }, { 0 }, { 0 } };
PyArrayObject *__pyx_r = NULL;
if (__pyx_optional_args) {
if (__pyx_optional_args->__pyx_n > 0) {
__pyx_v_kind = __pyx_optional_args->kind;
}
}
__Pyx_INCREF(__pyx_v_partials);
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_XDECREF(__pyx_t_5);
__Pyx_XDECREF(__pyx_t_6);
__PYX_XCLEAR_MEMVIEW(&__pyx_t_7, 1);
__Pyx_AddTraceback("pysndlib.clm.partials2polynomial", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XDECREF((PyObject *)__pyx_v_p);
__PYX_XCLEAR_MEMVIEW(&__pyx_v_p_view, 1);
__Pyx_XDECREF(__pyx_v_partials);
__Pyx_XGIVEREF((PyObject *)__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_129partials2polynomial(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_128partials2polynomial, "\n returns a chebyshev polynomial suitable for use with the polynomial generator to create (via\n waveshaping) the harmonic spectrum described by the partials argument.\n \n :param partials: list or np.ndarray of partials (harm and amp)\n :param kind: Polynomial.EITHER_KIND, Polynomial.FIRST_KIND, Polynomial.SECOND_KIND, Polynomial.BOTH_KINDS\n :return: chebyshev polynomial\n :rtype: np.ndarray\n \n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_129partials2polynomial = {"partials2polynomial", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_129partials2polynomial, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_128partials2polynomial};
static PyObject *__pyx_pw_8pysndlib_3clm_129partials2polynomial(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
PyObject *__pyx_v_partials = 0;
enum __pyx_t_8pysndlib_3clm_Polynomial __pyx_v_kind;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("partials2polynomial (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_partials,&__pyx_n_s_kind,0};
PyObject* values[2] = {0,0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_partials)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1859, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_kind);
if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1859, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "partials2polynomial") < 0)) __PYX_ERR(0, 1859, __pyx_L3_error)
}
} else {
switch (__pyx_nargs) {
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
break;
default: goto __pyx_L5_argtuple_error;
}
}
__pyx_v_partials = values[0];
if (values[1]) {
__pyx_v_kind = ((enum __pyx_t_8pysndlib_3clm_Polynomial)__Pyx_PyInt_As_enum____pyx_t_8pysndlib_3clm_Polynomial(values[1])); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1859, __pyx_L3_error)
} else {
__pyx_v_kind = __pyx_k__29;
}
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("partials2polynomial", 0, 1, 2, __pyx_nargs); __PYX_ERR(0, 1859, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.partials2polynomial", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_8pysndlib_3clm_128partials2polynomial(__pyx_self, __pyx_v_partials, __pyx_v_kind);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_128partials2polynomial(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_partials, enum __pyx_t_8pysndlib_3clm_Polynomial __pyx_v_kind) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_2.__pyx_n = 1;
__pyx_t_2.kind = __pyx_v_kind;
__pyx_t_1 = ((PyObject *)__pyx_f_8pysndlib_3clm_partials2polynomial(__pyx_v_partials, 0, &__pyx_t_2)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1859, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("pysndlib.clm.partials2polynomial", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_k__29 = __pyx_e_8pysndlib_3clm_FIRST_KIND;
/* … */
__pyx_tuple__255 = PyTuple_Pack(2, __pyx_n_s_partials, __pyx_n_s_kind); if (unlikely(!__pyx_tuple__255)) __PYX_ERR(0, 1859, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__255);
__Pyx_GIVEREF(__pyx_tuple__255);
__pyx_t_40 = __Pyx_Enum_Polynomial_to_py(__pyx_e_8pysndlib_3clm_FIRST_KIND); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 1859, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
__pyx_t_43 = PyTuple_New(1); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 1859, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
__Pyx_GIVEREF(__pyx_t_40);
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_43, 0, __pyx_t_40)) __PYX_ERR(0, 1859, __pyx_L1_error);
__pyx_t_40 = 0;
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_129partials2polynomial, 0, __pyx_n_s_partials2polynomial, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__256)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 1859, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
__Pyx_CyFunction_SetDefaultsTuple(__pyx_t_40, __pyx_t_43);
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
if (PyDict_SetItem(__pyx_d, __pyx_n_s_partials2polynomial, __pyx_t_40) < 0) __PYX_ERR(0, 1859, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
__pyx_codeobj__256 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__255, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_partials2polynomial, 1859, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__256)) __PYX_ERR(0, 1859, __pyx_L1_error)
1860: """
1861: returns a chebyshev polynomial suitable for use with the polynomial generator to create (via
1862: waveshaping) the harmonic spectrum described by the partials argument.
1863:
1864: :param partials: list or np.ndarray of partials (harm and amp)
1865: :param kind: Polynomial.EITHER_KIND, Polynomial.FIRST_KIND, Polynomial.SECOND_KIND, Polynomial.BOTH_KINDS
1866: :return: chebyshev polynomial
1867: :rtype: np.ndarray
1868:
1869: """
+1870: if isinstance(partials, list):
__pyx_t_1 = PyList_Check(__pyx_v_partials);
if (__pyx_t_1) {
/* … */
}
+1871: partials = np.array(partials, dtype=np.double)
__Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1871, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_array); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1871, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1871, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_v_partials); __Pyx_GIVEREF(__pyx_v_partials); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_partials)) __PYX_ERR(0, 1871, __pyx_L1_error); __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1871, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1871, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_double); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1871, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_dtype, __pyx_t_6) < 0) __PYX_ERR(0, 1871, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_2, __pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1871, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF_SET(__pyx_v_partials, __pyx_t_6); __pyx_t_6 = 0;
1872:
+1873: check_ndim(partials)
__pyx_t_6 = __pyx_f_8pysndlib_3clm_check_ndim(__pyx_v_partials, 0, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1873, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
1874:
+1875: p = to_partials(partials)
__pyx_t_6 = ((PyObject *)__pyx_f_8pysndlib_3clm_to_partials(__pyx_v_partials, 0)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1875, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_v_p = ((PyArrayObject *)__pyx_t_6); __pyx_t_6 = 0;
1876:
+1877: cdef double [:] p_view = p
__pyx_t_7 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(((PyObject *)__pyx_v_p), PyBUF_WRITABLE); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 1877, __pyx_L1_error) __pyx_v_p_view = __pyx_t_7; __pyx_t_7.memview = NULL; __pyx_t_7.data = NULL;
1878:
+1879: cclm.mus_partials_to_polynomial(len(p), &p_view[0], <cclm.mus_polynomial_t>kind)
__pyx_t_8 = PyObject_Length(((PyObject *)__pyx_v_p)); if (unlikely(__pyx_t_8 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1879, __pyx_L1_error) __pyx_t_9 = 0; __pyx_t_10 = -1; if (__pyx_t_9 < 0) { __pyx_t_9 += __pyx_v_p_view.shape[0]; if (unlikely(__pyx_t_9 < 0)) __pyx_t_10 = 0; } else if (unlikely(__pyx_t_9 >= __pyx_v_p_view.shape[0])) __pyx_t_10 = 0; if (unlikely(__pyx_t_10 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_10); __PYX_ERR(0, 1879, __pyx_L1_error) } (void)(mus_partials_to_polynomial(__pyx_t_8, (&(*((double *) ( /* dim=0 */ (__pyx_v_p_view.data + __pyx_t_9 * __pyx_v_p_view.strides[0]) )))), ((mus_polynomial_t)__pyx_v_kind)));
+1880: return p
__Pyx_XDECREF((PyObject *)__pyx_r); __Pyx_INCREF((PyObject *)__pyx_v_p); __pyx_r = __pyx_v_p; goto __pyx_L0;
1881:
1882:
+1883: cpdef np.ndarray normalize_partials(partials):
static PyObject *__pyx_pw_8pysndlib_3clm_131normalize_partials(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyArrayObject *__pyx_f_8pysndlib_3clm_normalize_partials(PyObject *__pyx_v_partials, CYTHON_UNUSED int __pyx_skip_dispatch) {
PyObject *__pyx_v_partials_arr = NULL;
PyObject *__pyx_v_p = NULL;
PyObject *__pyx_v_v = NULL;
PyObject *__pyx_v_v_normalized = NULL;
PyObject *__pyx_v_result = NULL;
PyArrayObject *__pyx_r = NULL;
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_XDECREF(__pyx_t_5);
__Pyx_AddTraceback("pysndlib.clm.normalize_partials", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XDECREF(__pyx_v_partials_arr);
__Pyx_XDECREF(__pyx_v_p);
__Pyx_XDECREF(__pyx_v_v);
__Pyx_XDECREF(__pyx_v_v_normalized);
__Pyx_XDECREF(__pyx_v_result);
__Pyx_XGIVEREF((PyObject *)__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_131normalize_partials(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_130normalize_partials, "\n scales the partial amplitudes in the list/array or list 'partials' by the inverse of their sum (so\n that they add to 1.0). creates new array\n\n :param partials: list or np.ndarray of partials (harm and amp)\n :return: normalized partials\n :rtype: np.ndarray \n \n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_131normalize_partials = {"normalize_partials", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_131normalize_partials, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_130normalize_partials};
static PyObject *__pyx_pw_8pysndlib_3clm_131normalize_partials(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
PyObject *__pyx_v_partials = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("normalize_partials (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_partials,0};
PyObject* values[1] = {0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_partials)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1883, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "normalize_partials") < 0)) __PYX_ERR(0, 1883, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 1)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
}
__pyx_v_partials = values[0];
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("normalize_partials", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 1883, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.normalize_partials", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_8pysndlib_3clm_130normalize_partials(__pyx_self, __pyx_v_partials);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_130normalize_partials(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_partials) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = ((PyObject *)__pyx_f_8pysndlib_3clm_normalize_partials(__pyx_v_partials, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1883, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("pysndlib.clm.normalize_partials", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_tuple__257 = PyTuple_Pack(1, __pyx_n_s_partials); if (unlikely(!__pyx_tuple__257)) __PYX_ERR(0, 1883, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__257);
__Pyx_GIVEREF(__pyx_tuple__257);
/* … */
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_131normalize_partials, 0, __pyx_n_s_normalize_partials, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__258)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 1883, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_normalize_partials, __pyx_t_40) < 0) __PYX_ERR(0, 1883, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
__pyx_codeobj__258 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__257, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_normalize_partials, 1883, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__258)) __PYX_ERR(0, 1883, __pyx_L1_error)
1884: """
1885: scales the partial amplitudes in the list/array or list 'partials' by the inverse of their sum (so
1886: that they add to 1.0). creates new array
1887:
1888: :param partials: list or np.ndarray of partials (harm and amp)
1889: :return: normalized partials
1890: :rtype: np.ndarray
1891:
1892: """
1893: # forgoing use of clm function as having some memory issues
1894: # also c function is meant for in place operation
1895: #allocate new array.
+1896: partials_arr = np.array(partials, dtype=np.double)
__Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1896, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_array); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1896, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1896, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_v_partials); __Pyx_GIVEREF(__pyx_v_partials); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_partials)) __PYX_ERR(0, 1896, __pyx_L1_error); __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1896, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1896, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_double); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1896, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_dtype, __pyx_t_5) < 0) __PYX_ERR(0, 1896, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1896, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_partials_arr = __pyx_t_5; __pyx_t_5 = 0;
1897:
+1898: check_ndim(partials_arr)
__pyx_t_5 = __pyx_f_8pysndlib_3clm_check_ndim(__pyx_v_partials_arr, 0, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1898, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
1899:
+1900: p = partials_arr[::2]
__pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_v_partials_arr, __pyx_slice__18); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1900, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_v_p = __pyx_t_5; __pyx_t_5 = 0;
1901:
+1902: v = partials_arr[1::2]
__pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_v_partials_arr, __pyx_slice__30); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1902, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_v_v = __pyx_t_5; __pyx_t_5 = 0; /* … */ __pyx_slice__30 = PySlice_New(__pyx_int_1, Py_None, __pyx_int_2); if (unlikely(!__pyx_slice__30)) __PYX_ERR(0, 1902, __pyx_L1_error) __Pyx_GOTREF(__pyx_slice__30); __Pyx_GIVEREF(__pyx_slice__30);
1903:
+1904: v_normalized = v / v.sum()
__pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_v, __pyx_n_s_sum); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1904, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_1 = NULL; __pyx_t_6 = 0; #if CYTHON_UNPACK_METHODS if (likely(PyMethod_Check(__pyx_t_3))) { __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_1)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_1); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); __pyx_t_6 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_1, NULL}; __pyx_t_5 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_6, 0+__pyx_t_6); __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1904, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } __pyx_t_3 = __Pyx_PyNumber_Divide(__pyx_v_v, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1904, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_v_v_normalized = __pyx_t_3; __pyx_t_3 = 0;
+1905: result = np.empty((p.size + v.size), dtype=np.double)
__Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1905, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_empty); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1905, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_p, __pyx_n_s_size); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1905, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_v, __pyx_n_s_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1905, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = PyNumber_Add(__pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1905, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1905, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_GIVEREF(__pyx_t_2); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2)) __PYX_ERR(0, 1905, __pyx_L1_error); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1905, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1905, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_double); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1905, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_dtype, __pyx_t_4) < 0) __PYX_ERR(0, 1905, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1905, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v_result = __pyx_t_4; __pyx_t_4 = 0;
+1906: result[0::2] = p
if (unlikely((PyObject_SetItem(__pyx_v_result, __pyx_slice__31, __pyx_v_p) < 0))) __PYX_ERR(0, 1906, __pyx_L1_error) /* … */ __pyx_slice__31 = PySlice_New(__pyx_int_0, Py_None, __pyx_int_2); if (unlikely(!__pyx_slice__31)) __PYX_ERR(0, 1906, __pyx_L1_error) __Pyx_GOTREF(__pyx_slice__31); __Pyx_GIVEREF(__pyx_slice__31);
+1907: result[1::2] = v_normalized
if (unlikely((PyObject_SetItem(__pyx_v_result, __pyx_slice__30, __pyx_v_v_normalized) < 0))) __PYX_ERR(0, 1907, __pyx_L1_error)
1908:
1909:
+1910: return result
__Pyx_XDECREF((PyObject *)__pyx_r); if (!(likely(((__pyx_v_result) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_result, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1910, __pyx_L1_error) __Pyx_INCREF(__pyx_v_result); __pyx_r = ((PyArrayObject *)__pyx_v_result); goto __pyx_L0;
1911:
+1912: cpdef cython.double chebyshev_tu_sum( cython.double x, np.ndarray tcoeffs, np.ndarray ucoeffs):
static PyObject *__pyx_pw_8pysndlib_3clm_133chebyshev_tu_sum(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static double __pyx_f_8pysndlib_3clm_chebyshev_tu_sum(double __pyx_v_x, PyArrayObject *__pyx_v_tcoeffs, PyArrayObject *__pyx_v_ucoeffs, CYTHON_UNUSED int __pyx_skip_dispatch) {
__Pyx_memviewslice __pyx_v_tcoeffs_view = { 0, 0, { 0 }, { 0 }, { 0 } };
__Pyx_memviewslice __pyx_v_ucoeffs_view = { 0, 0, { 0 }, { 0 }, { 0 } };
double __pyx_r;
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__PYX_XCLEAR_MEMVIEW(&__pyx_t_2, 1);
__Pyx_AddTraceback("pysndlib.clm.chebyshev_tu_sum", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = -1;
__pyx_L0:;
__PYX_XCLEAR_MEMVIEW(&__pyx_v_tcoeffs_view, 1);
__PYX_XCLEAR_MEMVIEW(&__pyx_v_ucoeffs_view, 1);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_133chebyshev_tu_sum(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_132chebyshev_tu_sum, "\n returns the sum of the weighted chebyshev polynomials tn and un, with phase x\n \n :param x: input\n :param tcoeffs: tn\n :param ucoeffs: un\n :rtype: float\n \n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_133chebyshev_tu_sum = {"chebyshev_tu_sum", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_133chebyshev_tu_sum, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_132chebyshev_tu_sum};
static PyObject *__pyx_pw_8pysndlib_3clm_133chebyshev_tu_sum(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
double __pyx_v_x;
PyArrayObject *__pyx_v_tcoeffs = 0;
PyArrayObject *__pyx_v_ucoeffs = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("chebyshev_tu_sum (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_tcoeffs,&__pyx_n_s_ucoeffs,0};
PyObject* values[3] = {0,0,0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_x)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1912, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_tcoeffs)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1912, __pyx_L3_error)
else {
__Pyx_RaiseArgtupleInvalid("chebyshev_tu_sum", 1, 3, 3, 1); __PYX_ERR(0, 1912, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 2:
if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_ucoeffs)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[2]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1912, __pyx_L3_error)
else {
__Pyx_RaiseArgtupleInvalid("chebyshev_tu_sum", 1, 3, 3, 2); __PYX_ERR(0, 1912, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "chebyshev_tu_sum") < 0)) __PYX_ERR(0, 1912, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 3)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
}
__pyx_v_x = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_x == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1912, __pyx_L3_error)
__pyx_v_tcoeffs = ((PyArrayObject *)values[1]);
__pyx_v_ucoeffs = ((PyArrayObject *)values[2]);
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("chebyshev_tu_sum", 1, 3, 3, __pyx_nargs); __PYX_ERR(0, 1912, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.chebyshev_tu_sum", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_tcoeffs), __pyx_ptype_5numpy_ndarray, 1, "tcoeffs", 0))) __PYX_ERR(0, 1912, __pyx_L1_error)
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ucoeffs), __pyx_ptype_5numpy_ndarray, 1, "ucoeffs", 0))) __PYX_ERR(0, 1912, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_132chebyshev_tu_sum(__pyx_self, __pyx_v_x, __pyx_v_tcoeffs, __pyx_v_ucoeffs);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_132chebyshev_tu_sum(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_x, PyArrayObject *__pyx_v_tcoeffs, PyArrayObject *__pyx_v_ucoeffs) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8pysndlib_3clm_chebyshev_tu_sum(__pyx_v_x, __pyx_v_tcoeffs, __pyx_v_ucoeffs, 0); if (unlikely(__pyx_t_1 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1912, __pyx_L1_error)
__pyx_t_2 = PyFloat_FromDouble(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1912, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("pysndlib.clm.chebyshev_tu_sum", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_tuple__259 = PyTuple_Pack(3, __pyx_n_s_x, __pyx_n_s_tcoeffs, __pyx_n_s_ucoeffs); if (unlikely(!__pyx_tuple__259)) __PYX_ERR(0, 1912, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__259);
__Pyx_GIVEREF(__pyx_tuple__259);
/* … */
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_133chebyshev_tu_sum, 0, __pyx_n_s_chebyshev_tu_sum, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__260)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 1912, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_chebyshev_tu_sum, __pyx_t_40) < 0) __PYX_ERR(0, 1912, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
__pyx_codeobj__260 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__259, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_chebyshev_tu_sum, 1912, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__260)) __PYX_ERR(0, 1912, __pyx_L1_error)
1913: """
1914: returns the sum of the weighted chebyshev polynomials tn and un, with phase x
1915:
1916: :param x: input
1917: :param tcoeffs: tn
1918: :param ucoeffs: un
1919: :rtype: float
1920:
1921: """
1922:
+1923: check_ndim(tcoeffs)
__pyx_t_1 = __pyx_f_8pysndlib_3clm_check_ndim(((PyObject *)__pyx_v_tcoeffs), 0, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1923, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+1924: check_ndim(ucoeffs)
__pyx_t_1 = __pyx_f_8pysndlib_3clm_check_ndim(((PyObject *)__pyx_v_ucoeffs), 0, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1924, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+1925: compare_shapes(tcoeffs, ucoeffs)
__pyx_t_1 = __pyx_f_8pysndlib_3clm_compare_shapes(((PyObject *)__pyx_v_tcoeffs), ((PyObject *)__pyx_v_ucoeffs), 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1925, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
1926:
+1927: cdef double [:] tcoeffs_view = tcoeffs
__pyx_t_2 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(((PyObject *)__pyx_v_tcoeffs), PyBUF_WRITABLE); if (unlikely(!__pyx_t_2.memview)) __PYX_ERR(0, 1927, __pyx_L1_error) __pyx_v_tcoeffs_view = __pyx_t_2; __pyx_t_2.memview = NULL; __pyx_t_2.data = NULL;
+1928: cdef double [:] ucoeffs_view = ucoeffs
__pyx_t_2 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(((PyObject *)__pyx_v_ucoeffs), PyBUF_WRITABLE); if (unlikely(!__pyx_t_2.memview)) __PYX_ERR(0, 1928, __pyx_L1_error) __pyx_v_ucoeffs_view = __pyx_t_2; __pyx_t_2.memview = NULL; __pyx_t_2.data = NULL;
+1929: return cclm.mus_chebyshev_tu_sum(x, len(tcoeffs), &tcoeffs_view[0], &ucoeffs_view[0])
__pyx_t_3 = PyObject_Length(((PyObject *)__pyx_v_tcoeffs)); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1929, __pyx_L1_error) __pyx_t_4 = 0; __pyx_t_5 = -1; if (__pyx_t_4 < 0) { __pyx_t_4 += __pyx_v_tcoeffs_view.shape[0]; if (unlikely(__pyx_t_4 < 0)) __pyx_t_5 = 0; } else if (unlikely(__pyx_t_4 >= __pyx_v_tcoeffs_view.shape[0])) __pyx_t_5 = 0; if (unlikely(__pyx_t_5 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_5); __PYX_ERR(0, 1929, __pyx_L1_error) } __pyx_t_6 = 0; __pyx_t_5 = -1; if (__pyx_t_6 < 0) { __pyx_t_6 += __pyx_v_ucoeffs_view.shape[0]; if (unlikely(__pyx_t_6 < 0)) __pyx_t_5 = 0; } else if (unlikely(__pyx_t_6 >= __pyx_v_ucoeffs_view.shape[0])) __pyx_t_5 = 0; if (unlikely(__pyx_t_5 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_5); __PYX_ERR(0, 1929, __pyx_L1_error) } __pyx_r = mus_chebyshev_tu_sum(__pyx_v_x, __pyx_t_3, (&(*((double *) ( /* dim=0 */ (__pyx_v_tcoeffs_view.data + __pyx_t_4 * __pyx_v_tcoeffs_view.strides[0]) )))), (&(*((double *) ( /* dim=0 */ (__pyx_v_ucoeffs_view.data + __pyx_t_6 * __pyx_v_ucoeffs_view.strides[0]) ))))); goto __pyx_L0;
1930:
1931:
+1932: cpdef cython.double chebyshev_t_sum(cython.double x, np.ndarray tcoeffs):
static PyObject *__pyx_pw_8pysndlib_3clm_135chebyshev_t_sum(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static double __pyx_f_8pysndlib_3clm_chebyshev_t_sum(double __pyx_v_x, PyArrayObject *__pyx_v_tcoeffs, CYTHON_UNUSED int __pyx_skip_dispatch) {
__Pyx_memviewslice __pyx_v_tcoeffs_view = { 0, 0, { 0 }, { 0 }, { 0 } };
double __pyx_r;
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__PYX_XCLEAR_MEMVIEW(&__pyx_t_2, 1);
__Pyx_AddTraceback("pysndlib.clm.chebyshev_t_sum", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = -1;
__pyx_L0:;
__PYX_XCLEAR_MEMVIEW(&__pyx_v_tcoeffs_view, 1);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_135chebyshev_t_sum(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_134chebyshev_t_sum, "\n returns the sum of the weighted chebyshev polynomials tn\n \n :param x: nput\n :param tcoeffs: tn\n :rtype: float\n \n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_135chebyshev_t_sum = {"chebyshev_t_sum", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_135chebyshev_t_sum, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_134chebyshev_t_sum};
static PyObject *__pyx_pw_8pysndlib_3clm_135chebyshev_t_sum(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
double __pyx_v_x;
PyArrayObject *__pyx_v_tcoeffs = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("chebyshev_t_sum (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_tcoeffs,0};
PyObject* values[2] = {0,0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_x)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1932, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_tcoeffs)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1932, __pyx_L3_error)
else {
__Pyx_RaiseArgtupleInvalid("chebyshev_t_sum", 1, 2, 2, 1); __PYX_ERR(0, 1932, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "chebyshev_t_sum") < 0)) __PYX_ERR(0, 1932, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 2)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
}
__pyx_v_x = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_x == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1932, __pyx_L3_error)
__pyx_v_tcoeffs = ((PyArrayObject *)values[1]);
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("chebyshev_t_sum", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 1932, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.chebyshev_t_sum", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_tcoeffs), __pyx_ptype_5numpy_ndarray, 1, "tcoeffs", 0))) __PYX_ERR(0, 1932, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_134chebyshev_t_sum(__pyx_self, __pyx_v_x, __pyx_v_tcoeffs);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_134chebyshev_t_sum(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_x, PyArrayObject *__pyx_v_tcoeffs) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8pysndlib_3clm_chebyshev_t_sum(__pyx_v_x, __pyx_v_tcoeffs, 0); if (unlikely(__pyx_t_1 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1932, __pyx_L1_error)
__pyx_t_2 = PyFloat_FromDouble(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1932, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("pysndlib.clm.chebyshev_t_sum", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_tuple__261 = PyTuple_Pack(2, __pyx_n_s_x, __pyx_n_s_tcoeffs); if (unlikely(!__pyx_tuple__261)) __PYX_ERR(0, 1932, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__261);
__Pyx_GIVEREF(__pyx_tuple__261);
/* … */
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_135chebyshev_t_sum, 0, __pyx_n_s_chebyshev_t_sum, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__262)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 1932, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_chebyshev_t_sum, __pyx_t_40) < 0) __PYX_ERR(0, 1932, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
__pyx_codeobj__262 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__261, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_chebyshev_t_sum, 1932, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__262)) __PYX_ERR(0, 1932, __pyx_L1_error)
1933: """
1934: returns the sum of the weighted chebyshev polynomials tn
1935:
1936: :param x: nput
1937: :param tcoeffs: tn
1938: :rtype: float
1939:
1940: """
1941:
+1942: check_ndim(tcoeffs)
__pyx_t_1 = __pyx_f_8pysndlib_3clm_check_ndim(((PyObject *)__pyx_v_tcoeffs), 0, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1942, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
1943:
+1944: cdef double [:] tcoeffs_view = tcoeffs
__pyx_t_2 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(((PyObject *)__pyx_v_tcoeffs), PyBUF_WRITABLE); if (unlikely(!__pyx_t_2.memview)) __PYX_ERR(0, 1944, __pyx_L1_error) __pyx_v_tcoeffs_view = __pyx_t_2; __pyx_t_2.memview = NULL; __pyx_t_2.data = NULL;
+1945: return cclm.mus_chebyshev_t_sum(x,len(tcoeffs), &tcoeffs_view[0])
__pyx_t_3 = PyObject_Length(((PyObject *)__pyx_v_tcoeffs)); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1945, __pyx_L1_error) __pyx_t_4 = 0; __pyx_t_5 = -1; if (__pyx_t_4 < 0) { __pyx_t_4 += __pyx_v_tcoeffs_view.shape[0]; if (unlikely(__pyx_t_4 < 0)) __pyx_t_5 = 0; } else if (unlikely(__pyx_t_4 >= __pyx_v_tcoeffs_view.shape[0])) __pyx_t_5 = 0; if (unlikely(__pyx_t_5 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_5); __PYX_ERR(0, 1945, __pyx_L1_error) } __pyx_r = mus_chebyshev_t_sum(__pyx_v_x, __pyx_t_3, (&(*((double *) ( /* dim=0 */ (__pyx_v_tcoeffs_view.data + __pyx_t_4 * __pyx_v_tcoeffs_view.strides[0]) ))))); goto __pyx_L0;
1946:
+1947: cpdef cython.double chebyshev_u_sum(cython.double x, np.ndarray ucoeffs):
static PyObject *__pyx_pw_8pysndlib_3clm_137chebyshev_u_sum(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static double __pyx_f_8pysndlib_3clm_chebyshev_u_sum(double __pyx_v_x, PyArrayObject *__pyx_v_ucoeffs, CYTHON_UNUSED int __pyx_skip_dispatch) {
__Pyx_memviewslice __pyx_v_ucoeffs_view = { 0, 0, { 0 }, { 0 }, { 0 } };
double __pyx_r;
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__PYX_XCLEAR_MEMVIEW(&__pyx_t_2, 1);
__Pyx_AddTraceback("pysndlib.clm.chebyshev_u_sum", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = -1;
__pyx_L0:;
__PYX_XCLEAR_MEMVIEW(&__pyx_v_ucoeffs_view, 1);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_137chebyshev_u_sum(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_136chebyshev_u_sum, "\n returns the sum of the weighted chebyshev polynomials un\n \n :param x: input\n :param ucoeffs: un\n :rtype: float\n \n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_137chebyshev_u_sum = {"chebyshev_u_sum", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_137chebyshev_u_sum, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_136chebyshev_u_sum};
static PyObject *__pyx_pw_8pysndlib_3clm_137chebyshev_u_sum(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
double __pyx_v_x;
PyArrayObject *__pyx_v_ucoeffs = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("chebyshev_u_sum (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_ucoeffs,0};
PyObject* values[2] = {0,0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_x)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1947, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_ucoeffs)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1947, __pyx_L3_error)
else {
__Pyx_RaiseArgtupleInvalid("chebyshev_u_sum", 1, 2, 2, 1); __PYX_ERR(0, 1947, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "chebyshev_u_sum") < 0)) __PYX_ERR(0, 1947, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 2)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
}
__pyx_v_x = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_x == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1947, __pyx_L3_error)
__pyx_v_ucoeffs = ((PyArrayObject *)values[1]);
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("chebyshev_u_sum", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 1947, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.chebyshev_u_sum", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ucoeffs), __pyx_ptype_5numpy_ndarray, 1, "ucoeffs", 0))) __PYX_ERR(0, 1947, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_136chebyshev_u_sum(__pyx_self, __pyx_v_x, __pyx_v_ucoeffs);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_136chebyshev_u_sum(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_x, PyArrayObject *__pyx_v_ucoeffs) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8pysndlib_3clm_chebyshev_u_sum(__pyx_v_x, __pyx_v_ucoeffs, 0); if (unlikely(__pyx_t_1 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1947, __pyx_L1_error)
__pyx_t_2 = PyFloat_FromDouble(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1947, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("pysndlib.clm.chebyshev_u_sum", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_tuple__263 = PyTuple_Pack(2, __pyx_n_s_x, __pyx_n_s_ucoeffs); if (unlikely(!__pyx_tuple__263)) __PYX_ERR(0, 1947, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__263);
__Pyx_GIVEREF(__pyx_tuple__263);
/* … */
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_137chebyshev_u_sum, 0, __pyx_n_s_chebyshev_u_sum, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__264)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 1947, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_chebyshev_u_sum, __pyx_t_40) < 0) __PYX_ERR(0, 1947, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
__pyx_codeobj__264 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__263, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_chebyshev_u_sum, 1947, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__264)) __PYX_ERR(0, 1947, __pyx_L1_error)
1948: """
1949: returns the sum of the weighted chebyshev polynomials un
1950:
1951: :param x: input
1952: :param ucoeffs: un
1953: :rtype: float
1954:
1955: """
1956:
+1957: check_ndim(ucoeffs)
__pyx_t_1 = __pyx_f_8pysndlib_3clm_check_ndim(((PyObject *)__pyx_v_ucoeffs), 0, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1957, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
1958:
+1959: cdef double [:] ucoeffs_view = ucoeffs
__pyx_t_2 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(((PyObject *)__pyx_v_ucoeffs), PyBUF_WRITABLE); if (unlikely(!__pyx_t_2.memview)) __PYX_ERR(0, 1959, __pyx_L1_error) __pyx_v_ucoeffs_view = __pyx_t_2; __pyx_t_2.memview = NULL; __pyx_t_2.data = NULL;
+1960: return cclm.mus_chebyshev_u_sum(x,len(ucoeffs), &ucoeffs_view[0])
__pyx_t_3 = PyObject_Length(((PyObject *)__pyx_v_ucoeffs)); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1960, __pyx_L1_error) __pyx_t_4 = 0; __pyx_t_5 = -1; if (__pyx_t_4 < 0) { __pyx_t_4 += __pyx_v_ucoeffs_view.shape[0]; if (unlikely(__pyx_t_4 < 0)) __pyx_t_5 = 0; } else if (unlikely(__pyx_t_4 >= __pyx_v_ucoeffs_view.shape[0])) __pyx_t_5 = 0; if (unlikely(__pyx_t_5 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_5); __PYX_ERR(0, 1960, __pyx_L1_error) } __pyx_r = mus_chebyshev_u_sum(__pyx_v_x, __pyx_t_3, (&(*((double *) ( /* dim=0 */ (__pyx_v_ucoeffs_view.data + __pyx_t_4 * __pyx_v_ucoeffs_view.strides[0]) ))))); goto __pyx_L0;
1961:
1962:
1963:
1964:
1965: # ---------------- oscil ---------------- #
+1966: cpdef mus_any make_oscil(cython.double frequency=0.,cython.double initial_phase = 0.0):
static PyObject *__pyx_pw_8pysndlib_3clm_139make_oscil(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_f_8pysndlib_3clm_make_oscil(CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_8pysndlib_3clm_make_oscil *__pyx_optional_args) {
double __pyx_v_frequency = ((double)0.);
double __pyx_v_initial_phase = ((double)0.0);
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_r = NULL;
if (__pyx_optional_args) {
if (__pyx_optional_args->__pyx_n > 0) {
__pyx_v_frequency = __pyx_optional_args->frequency;
if (__pyx_optional_args->__pyx_n > 1) {
__pyx_v_initial_phase = __pyx_optional_args->initial_phase;
}
}
}
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_AddTraceback("pysndlib.clm.make_oscil", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XGIVEREF((PyObject *)__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_139make_oscil(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_138make_oscil, "\n return a new oscil (sinewave) generator\n \n :param frequency: frequency in hz\n :param initial_phase: initial phase in radians\n :return: oscil gen\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_139make_oscil = {"make_oscil", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_139make_oscil, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_138make_oscil};
static PyObject *__pyx_pw_8pysndlib_3clm_139make_oscil(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
double __pyx_v_frequency;
double __pyx_v_initial_phase;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("make_oscil (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_frequency,&__pyx_n_s_initial_phase,0};
PyObject* values[2] = {0,0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_frequency);
if (value) { values[0] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1966, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 1:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_initial_phase);
if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1966, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "make_oscil") < 0)) __PYX_ERR(0, 1966, __pyx_L3_error)
}
} else {
switch (__pyx_nargs) {
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
}
if (values[0]) {
__pyx_v_frequency = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_frequency == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1966, __pyx_L3_error)
} else {
__pyx_v_frequency = ((double)0.);
}
if (values[1]) {
__pyx_v_initial_phase = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_initial_phase == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1966, __pyx_L3_error)
} else {
__pyx_v_initial_phase = ((double)0.0);
}
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("make_oscil", 0, 0, 2, __pyx_nargs); __PYX_ERR(0, 1966, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.make_oscil", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_8pysndlib_3clm_138make_oscil(__pyx_self, __pyx_v_frequency, __pyx_v_initial_phase);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_138make_oscil(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_frequency, double __pyx_v_initial_phase) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_2.__pyx_n = 2;
__pyx_t_2.frequency = __pyx_v_frequency;
__pyx_t_2.initial_phase = __pyx_v_initial_phase;
__pyx_t_1 = ((PyObject *)__pyx_f_8pysndlib_3clm_make_oscil(0, &__pyx_t_2)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1966, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("pysndlib.clm.make_oscil", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_tuple__265 = PyTuple_Pack(2, __pyx_n_s_frequency, __pyx_n_s_initial_phase); if (unlikely(!__pyx_tuple__265)) __PYX_ERR(0, 1966, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__265);
__Pyx_GIVEREF(__pyx_tuple__265);
__pyx_codeobj__266 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__265, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_make_oscil, 1966, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__266)) __PYX_ERR(0, 1966, __pyx_L1_error)
/* … */
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_139make_oscil, 0, __pyx_n_s_make_oscil, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__266)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 1966, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
__Pyx_CyFunction_SetDefaultsTuple(__pyx_t_40, __pyx_tuple__267);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_make_oscil, __pyx_t_40) < 0) __PYX_ERR(0, 1966, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
__pyx_tuple__267 = PyTuple_Pack(2, __pyx_float_0_, __pyx_float_0_0); if (unlikely(!__pyx_tuple__267)) __PYX_ERR(0, 1966, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__267);
__Pyx_GIVEREF(__pyx_tuple__267);
/* … */
struct __pyx_opt_args_8pysndlib_3clm_make_oscil {
int __pyx_n;
double frequency;
double initial_phase;
};
1967: """
1968: return a new oscil (sinewave) generator
1969:
1970: :param frequency: frequency in hz
1971: :param initial_phase: initial phase in radians
1972: :return: oscil gen
1973: """
+1974: check_range('frequency', frequency, 0., get_srate() / 2)
__pyx_t_1 = PyFloat_FromDouble(__pyx_v_frequency); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1974, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __pyx_f_8pysndlib_3clm_get_srate(0); if (unlikely(__pyx_t_2 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1974, __pyx_L1_error) __pyx_t_3 = PyFloat_FromDouble((__pyx_t_2 / 2.0)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1974, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_5.__pyx_n = 2; __pyx_t_5.low = __pyx_float_0_; __pyx_t_5.high = __pyx_t_3; __pyx_t_4 = __pyx_f_8pysndlib_3clm_check_range(__pyx_n_s_frequency, __pyx_t_1, 0, &__pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1974, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
1975:
1976:
+1977: return mus_any.from_ptr(cclm.mus_make_oscil(frequency, initial_phase))
__Pyx_XDECREF((PyObject *)__pyx_r); __pyx_t_4 = ((PyObject *)__pyx_vtabptr_8pysndlib_3clm_mus_any->from_ptr(mus_make_oscil(__pyx_v_frequency, __pyx_v_initial_phase), NULL)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1977, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_r = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_t_4); __pyx_t_4 = 0; goto __pyx_L0;
1978:
1979: ## Changing to avoid None overhead. Think it slows thing s down even if mus_oscil_unmodulated can be used.
+1980: cpdef cython.double oscil(mus_any gen, cython.double fm=0.0, cython.double pm=0.0):
static PyObject *__pyx_pw_8pysndlib_3clm_141oscil(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static double __pyx_f_8pysndlib_3clm_oscil(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_8pysndlib_3clm_oscil *__pyx_optional_args) {
double __pyx_v_fm = ((double)0.0);
double __pyx_v_pm = ((double)0.0);
double __pyx_r;
if (__pyx_optional_args) {
if (__pyx_optional_args->__pyx_n > 0) {
__pyx_v_fm = __pyx_optional_args->fm;
if (__pyx_optional_args->__pyx_n > 1) {
__pyx_v_pm = __pyx_optional_args->pm;
}
}
}
/* … */
/* function exit code */
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_141oscil(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_140oscil, "\n return next sample from oscil gen: val = sin(phase + pm); phase += (freq + fm)\n \n :param gen: oscil gen\n :param fm: fm input\n :param pm: pm input\n :rtype: float\n \n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_141oscil = {"oscil", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_141oscil, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_140oscil};
static PyObject *__pyx_pw_8pysndlib_3clm_141oscil(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = 0;
double __pyx_v_fm;
double __pyx_v_pm;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("oscil (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gen,&__pyx_n_s_fm,&__pyx_n_s_pm,0};
PyObject* values[3] = {0,0,0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_gen)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1980, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_fm);
if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1980, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 2:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pm);
if (value) { values[2] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1980, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "oscil") < 0)) __PYX_ERR(0, 1980, __pyx_L3_error)
}
} else {
switch (__pyx_nargs) {
case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
break;
default: goto __pyx_L5_argtuple_error;
}
}
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)values[0]);
if (values[1]) {
__pyx_v_fm = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_fm == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1980, __pyx_L3_error)
} else {
__pyx_v_fm = ((double)0.0);
}
if (values[2]) {
__pyx_v_pm = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_pm == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1980, __pyx_L3_error)
} else {
__pyx_v_pm = ((double)0.0);
}
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("oscil", 0, 1, 3, __pyx_nargs); __PYX_ERR(0, 1980, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.oscil", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gen), __pyx_ptype_8pysndlib_3clm_mus_any, 1, "gen", 0))) __PYX_ERR(0, 1980, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_140oscil(__pyx_self, __pyx_v_gen, __pyx_v_fm, __pyx_v_pm);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_140oscil(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, double __pyx_v_fm, double __pyx_v_pm) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_2.__pyx_n = 2;
__pyx_t_2.fm = __pyx_v_fm;
__pyx_t_2.pm = __pyx_v_pm;
__pyx_t_1 = __pyx_f_8pysndlib_3clm_oscil(__pyx_v_gen, 0, &__pyx_t_2); if (unlikely(__pyx_t_1 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1980, __pyx_L1_error)
__pyx_t_3 = PyFloat_FromDouble(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1980, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__pyx_r = __pyx_t_3;
__pyx_t_3 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_3);
__Pyx_AddTraceback("pysndlib.clm.oscil", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_tuple__268 = PyTuple_Pack(3, __pyx_n_s_gen, __pyx_n_s_fm, __pyx_n_s_pm); if (unlikely(!__pyx_tuple__268)) __PYX_ERR(0, 1980, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__268);
__Pyx_GIVEREF(__pyx_tuple__268);
__pyx_codeobj__269 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__268, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_oscil, 1980, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__269)) __PYX_ERR(0, 1980, __pyx_L1_error)
/* … */
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_141oscil, 0, __pyx_n_s_oscil, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__269)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 1980, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
__Pyx_CyFunction_SetDefaultsTuple(__pyx_t_40, __pyx_tuple__270);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_oscil, __pyx_t_40) < 0) __PYX_ERR(0, 1980, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
__pyx_tuple__270 = PyTuple_Pack(2, __pyx_float_0_0, __pyx_float_0_0); if (unlikely(!__pyx_tuple__270)) __PYX_ERR(0, 1980, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__270);
__Pyx_GIVEREF(__pyx_tuple__270);
1981: """
1982: return next sample from oscil gen: val = sin(phase + pm); phase += (freq + fm)
1983:
1984: :param gen: oscil gen
1985: :param fm: fm input
1986: :param pm: pm input
1987: :rtype: float
1988:
1989: """
+1990: return cclm.mus_oscil(gen._ptr, fm, pm)
__pyx_r = mus_oscil(__pyx_v_gen->_ptr, __pyx_v_fm, __pyx_v_pm); goto __pyx_L0;
1991:
+1992: cpdef cython.double oscil_unmodulated(mus_any gen):
static PyObject *__pyx_pw_8pysndlib_3clm_143oscil_unmodulated(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static double __pyx_f_8pysndlib_3clm_oscil_unmodulated(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, CYTHON_UNUSED int __pyx_skip_dispatch) {
double __pyx_r;
/* … */
/* function exit code */
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_143oscil_unmodulated(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_142oscil_unmodulated, "\n return next sample from oscil gen. no modulation\n \n :param gen: oscil gen\n :rtype: float\n \n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_143oscil_unmodulated = {"oscil_unmodulated", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_143oscil_unmodulated, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_142oscil_unmodulated};
static PyObject *__pyx_pw_8pysndlib_3clm_143oscil_unmodulated(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("oscil_unmodulated (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gen,0};
PyObject* values[1] = {0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_gen)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1992, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "oscil_unmodulated") < 0)) __PYX_ERR(0, 1992, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 1)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
}
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)values[0]);
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("oscil_unmodulated", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 1992, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.oscil_unmodulated", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gen), __pyx_ptype_8pysndlib_3clm_mus_any, 1, "gen", 0))) __PYX_ERR(0, 1992, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_142oscil_unmodulated(__pyx_self, __pyx_v_gen);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_142oscil_unmodulated(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8pysndlib_3clm_oscil_unmodulated(__pyx_v_gen, 0); if (unlikely(__pyx_t_1 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1992, __pyx_L1_error)
__pyx_t_2 = PyFloat_FromDouble(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1992, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("pysndlib.clm.oscil_unmodulated", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_143oscil_unmodulated, 0, __pyx_n_s_oscil_unmodulated, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__271)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 1992, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_oscil_unmodulated, __pyx_t_40) < 0) __PYX_ERR(0, 1992, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
/* … */
__pyx_codeobj__271 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__56, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_oscil_unmodulated, 1992, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__271)) __PYX_ERR(0, 1992, __pyx_L1_error)
1993: """
1994: return next sample from oscil gen. no modulation
1995:
1996: :param gen: oscil gen
1997: :rtype: float
1998:
1999: """
+2000: return cclm.mus_oscil_unmodulated(gen._ptr)
__pyx_r = mus_oscil_unmodulated(__pyx_v_gen->_ptr); goto __pyx_L0;
2001:
+2002: cpdef bint is_oscil(mus_any gen):
static PyObject *__pyx_pw_8pysndlib_3clm_145is_oscil(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static int __pyx_f_8pysndlib_3clm_is_oscil(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, CYTHON_UNUSED int __pyx_skip_dispatch) {
int __pyx_r;
/* … */
/* function exit code */
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_145is_oscil(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_144is_oscil, "\n returns True if gen is an oscil\n \n :param gen: oscil gen\n :rtype: bool\n \n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_145is_oscil = {"is_oscil", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_145is_oscil, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_144is_oscil};
static PyObject *__pyx_pw_8pysndlib_3clm_145is_oscil(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("is_oscil (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gen,0};
PyObject* values[1] = {0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_gen)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2002, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "is_oscil") < 0)) __PYX_ERR(0, 2002, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 1)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
}
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)values[0]);
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("is_oscil", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 2002, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.is_oscil", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gen), __pyx_ptype_8pysndlib_3clm_mus_any, 1, "gen", 0))) __PYX_ERR(0, 2002, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_144is_oscil(__pyx_self, __pyx_v_gen);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_144is_oscil(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8pysndlib_3clm_is_oscil(__pyx_v_gen, 0); if (unlikely(__pyx_t_1 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2002, __pyx_L1_error)
__pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2002, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("pysndlib.clm.is_oscil", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_145is_oscil, 0, __pyx_n_s_is_oscil, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__272)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 2002, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_is_oscil, __pyx_t_40) < 0) __PYX_ERR(0, 2002, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
/* … */
__pyx_codeobj__272 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__56, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_is_oscil, 2002, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__272)) __PYX_ERR(0, 2002, __pyx_L1_error)
2003: """
2004: returns True if gen is an oscil
2005:
2006: :param gen: oscil gen
2007: :rtype: bool
2008:
2009: """
+2010: return cclm.mus_is_oscil(gen._ptr)
__pyx_r = mus_is_oscil(__pyx_v_gen->_ptr); goto __pyx_L0;
2011:
2012: # ---------------- oscil-bank ---------------- #
2013:
+2014: cpdef mus_any make_oscil_bank(freqs, phases, amps=None, bint stable=False):
static PyObject *__pyx_pw_8pysndlib_3clm_147make_oscil_bank(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_f_8pysndlib_3clm_make_oscil_bank(PyObject *__pyx_v_freqs, PyObject *__pyx_v_phases, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_8pysndlib_3clm_make_oscil_bank *__pyx_optional_args) {
PyObject *__pyx_v_amps = ((PyObject *)Py_None);
int __pyx_v_stable = ((int)0);
__Pyx_memviewslice __pyx_v_freqs_view = { 0, 0, { 0 }, { 0 }, { 0 } };
__Pyx_memviewslice __pyx_v_phases_view = { 0, 0, { 0 }, { 0 }, { 0 } };
__Pyx_memviewslice __pyx_v_amps_view = { 0, 0, { 0 }, { 0 }, { 0 } };
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = NULL;
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_r = NULL;
if (__pyx_optional_args) {
if (__pyx_optional_args->__pyx_n > 0) {
__pyx_v_amps = __pyx_optional_args->amps;
if (__pyx_optional_args->__pyx_n > 1) {
__pyx_v_stable = __pyx_optional_args->stable;
}
}
}
__Pyx_INCREF(__pyx_v_freqs);
__Pyx_INCREF(__pyx_v_phases);
__Pyx_INCREF(__pyx_v_amps);
/* … */
/* function exit code */
__pyx_L1_error:;
__PYX_XCLEAR_MEMVIEW(&__pyx_t_1, 1);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_XDECREF(__pyx_t_5);
__Pyx_XDECREF(__pyx_t_6);
__Pyx_XDECREF(__pyx_t_7);
__Pyx_AddTraceback("pysndlib.clm.make_oscil_bank", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__PYX_XCLEAR_MEMVIEW(&__pyx_v_freqs_view, 1);
__PYX_XCLEAR_MEMVIEW(&__pyx_v_phases_view, 1);
__PYX_XCLEAR_MEMVIEW(&__pyx_v_amps_view, 1);
__Pyx_XDECREF((PyObject *)__pyx_v_gen);
__Pyx_XDECREF(__pyx_v_freqs);
__Pyx_XDECREF(__pyx_v_phases);
__Pyx_XDECREF(__pyx_v_amps);
__Pyx_XGIVEREF((PyObject *)__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_147make_oscil_bank(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_146make_oscil_bank, "\n return a new oscil_bank generator. (freqs in radians)\n \n :param freqs: list or np.ndarray of frequencies in radians\n :param phases: list or np.ndarray of initial phases in radians\n :param stable: if it is true, oscil_bank can assume that the frequency. this is not operative\n :return: oscil_bank gen\n :rtype: mus_any\n \n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_147make_oscil_bank = {"make_oscil_bank", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_147make_oscil_bank, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_146make_oscil_bank};
static PyObject *__pyx_pw_8pysndlib_3clm_147make_oscil_bank(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
PyObject *__pyx_v_freqs = 0;
PyObject *__pyx_v_phases = 0;
PyObject *__pyx_v_amps = 0;
int __pyx_v_stable;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("make_oscil_bank (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_freqs,&__pyx_n_s_phases,&__pyx_n_s_amps,&__pyx_n_s_stable,0};
PyObject* values[4] = {0,0,0,0};
values[2] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
CYTHON_FALLTHROUGH;
case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_freqs)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2014, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_phases)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2014, __pyx_L3_error)
else {
__Pyx_RaiseArgtupleInvalid("make_oscil_bank", 0, 2, 4, 1); __PYX_ERR(0, 2014, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 2:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_amps);
if (value) { values[2] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2014, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 3:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_stable);
if (value) { values[3] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2014, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "make_oscil_bank") < 0)) __PYX_ERR(0, 2014, __pyx_L3_error)
}
} else {
switch (__pyx_nargs) {
case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
CYTHON_FALLTHROUGH;
case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
break;
default: goto __pyx_L5_argtuple_error;
}
}
__pyx_v_freqs = values[0];
__pyx_v_phases = values[1];
__pyx_v_amps = values[2];
if (values[3]) {
__pyx_v_stable = __Pyx_PyObject_IsTrue(values[3]); if (unlikely((__pyx_v_stable == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2014, __pyx_L3_error)
} else {
__pyx_v_stable = ((int)0);
}
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("make_oscil_bank", 0, 2, 4, __pyx_nargs); __PYX_ERR(0, 2014, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.make_oscil_bank", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_8pysndlib_3clm_146make_oscil_bank(__pyx_self, __pyx_v_freqs, __pyx_v_phases, __pyx_v_amps, __pyx_v_stable);
/* function exit code */
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_146make_oscil_bank(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_freqs, PyObject *__pyx_v_phases, PyObject *__pyx_v_amps, int __pyx_v_stable) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_2.__pyx_n = 2;
__pyx_t_2.amps = __pyx_v_amps;
__pyx_t_2.stable = __pyx_v_stable;
__pyx_t_1 = ((PyObject *)__pyx_f_8pysndlib_3clm_make_oscil_bank(__pyx_v_freqs, __pyx_v_phases, 0, &__pyx_t_2)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2014, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("pysndlib.clm.make_oscil_bank", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_tuple__273 = PyTuple_Pack(4, __pyx_n_s_freqs, __pyx_n_s_phases, __pyx_n_s_amps, __pyx_n_s_stable); if (unlikely(!__pyx_tuple__273)) __PYX_ERR(0, 2014, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__273);
__Pyx_GIVEREF(__pyx_tuple__273);
__pyx_codeobj__274 = (PyObject*)__Pyx_PyCode_New(4, 0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__273, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_make_oscil_bank, 2014, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__274)) __PYX_ERR(0, 2014, __pyx_L1_error)
/* … */
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_147make_oscil_bank, 0, __pyx_n_s_make_oscil_bank, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__274)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 2014, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
__Pyx_CyFunction_SetDefaultsTuple(__pyx_t_40, __pyx_tuple__275);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_make_oscil_bank, __pyx_t_40) < 0) __PYX_ERR(0, 2014, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
__pyx_tuple__275 = PyTuple_Pack(2, Py_None, Py_False); if (unlikely(!__pyx_tuple__275)) __PYX_ERR(0, 2014, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__275);
__Pyx_GIVEREF(__pyx_tuple__275);
/* … */
struct __pyx_opt_args_8pysndlib_3clm_make_oscil_bank {
int __pyx_n;
PyObject *amps;
int stable;
};
2015: """
2016: return a new oscil_bank generator. (freqs in radians)
2017:
2018: :param freqs: list or np.ndarray of frequencies in radians
2019: :param phases: list or np.ndarray of initial phases in radians
2020: :param stable: if it is true, oscil_bank can assume that the frequency. this is not operative
2021: :return: oscil_bank gen
2022: :rtype: mus_any
2023:
2024: """
+2025: cdef cclm.mus_float_t [:] freqs_view = None
__pyx_t_1 = __Pyx_PyObject_to_MemoryviewSlice_ds_nn_mus_float_t(Py_None, PyBUF_WRITABLE); if (unlikely(!__pyx_t_1.memview)) __PYX_ERR(0, 2025, __pyx_L1_error) __pyx_v_freqs_view = __pyx_t_1; __pyx_t_1.memview = NULL; __pyx_t_1.data = NULL;
+2026: cdef cclm.mus_float_t [:] phases_view = None
__pyx_t_1 = __Pyx_PyObject_to_MemoryviewSlice_ds_nn_mus_float_t(Py_None, PyBUF_WRITABLE); if (unlikely(!__pyx_t_1.memview)) __PYX_ERR(0, 2026, __pyx_L1_error) __pyx_v_phases_view = __pyx_t_1; __pyx_t_1.memview = NULL; __pyx_t_1.data = NULL;
+2027: cdef cclm.mus_float_t [:] amps_view = None
__pyx_t_1 = __Pyx_PyObject_to_MemoryviewSlice_ds_nn_mus_float_t(Py_None, PyBUF_WRITABLE); if (unlikely(!__pyx_t_1.memview)) __PYX_ERR(0, 2027, __pyx_L1_error) __pyx_v_amps_view = __pyx_t_1; __pyx_t_1.memview = NULL; __pyx_t_1.data = NULL;
2028:
+2029: if isinstance(freqs, list):
__pyx_t_2 = PyList_Check(__pyx_v_freqs);
if (__pyx_t_2) {
/* … */
}
+2030: freqs = np.array(freqs, dtype=np.double)
__Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2030, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_array); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2030, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2030, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_v_freqs); __Pyx_GIVEREF(__pyx_v_freqs); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_freqs)) __PYX_ERR(0, 2030, __pyx_L1_error); __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2030, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2030, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_double); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2030, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_dtype, __pyx_t_7) < 0) __PYX_ERR(0, 2030, __pyx_L1_error) __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2030, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF_SET(__pyx_v_freqs, __pyx_t_7); __pyx_t_7 = 0;
+2031: if isinstance(phases, list):
__pyx_t_2 = PyList_Check(__pyx_v_phases);
if (__pyx_t_2) {
/* … */
}
+2032: phases = np.array(phases, dtype=np.double)
__Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2032, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_array); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2032, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2032, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_INCREF(__pyx_v_phases); __Pyx_GIVEREF(__pyx_v_phases); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_phases)) __PYX_ERR(0, 2032, __pyx_L1_error); __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2032, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2032, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_double); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2032, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_dtype, __pyx_t_6) < 0) __PYX_ERR(0, 2032, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_7, __pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2032, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF_SET(__pyx_v_phases, __pyx_t_6); __pyx_t_6 = 0;
2033:
+2034: check_ndim(freqs)
__pyx_t_6 = __pyx_f_8pysndlib_3clm_check_ndim(__pyx_v_freqs, 0, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2034, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+2035: check_ndim(phases)
__pyx_t_6 = __pyx_f_8pysndlib_3clm_check_ndim(__pyx_v_phases, 0, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2035, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+2036: compare_shapes(freqs, phases)
__pyx_t_6 = __pyx_f_8pysndlib_3clm_compare_shapes(__pyx_v_freqs, __pyx_v_phases, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2036, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
2037:
+2038: freqs_view = freqs
__pyx_t_1 = __Pyx_PyObject_to_MemoryviewSlice_ds_nn_mus_float_t(__pyx_v_freqs, PyBUF_WRITABLE); if (unlikely(!__pyx_t_1.memview)) __PYX_ERR(0, 2038, __pyx_L1_error) __PYX_XCLEAR_MEMVIEW(&__pyx_v_freqs_view, 1); __pyx_v_freqs_view = __pyx_t_1; __pyx_t_1.memview = NULL; __pyx_t_1.data = NULL;
+2039: phases_view = phases
__pyx_t_1 = __Pyx_PyObject_to_MemoryviewSlice_ds_nn_mus_float_t(__pyx_v_phases, PyBUF_WRITABLE); if (unlikely(!__pyx_t_1.memview)) __PYX_ERR(0, 2039, __pyx_L1_error) __PYX_XCLEAR_MEMVIEW(&__pyx_v_phases_view, 1); __pyx_v_phases_view = __pyx_t_1; __pyx_t_1.memview = NULL; __pyx_t_1.data = NULL;
2040:
+2041: if amps is not None:
__pyx_t_2 = (__pyx_v_amps != Py_None);
if (__pyx_t_2) {
/* … */
goto __pyx_L5;
}
+2042: if isinstance(amps, list):
__pyx_t_2 = PyList_Check(__pyx_v_amps);
if (__pyx_t_2) {
/* … */
}
+2043: amps = np.array(amps, dtype=np.double)
__Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2043, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_array); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2043, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2043, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_INCREF(__pyx_v_amps); __Pyx_GIVEREF(__pyx_v_amps); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_amps)) __PYX_ERR(0, 2043, __pyx_L1_error); __pyx_t_7 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2043, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2043, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_double); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2043, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_dtype, __pyx_t_4) < 0) __PYX_ERR(0, 2043, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, __pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2043, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF_SET(__pyx_v_amps, __pyx_t_4); __pyx_t_4 = 0;
+2044: check_ndim(amps)
__pyx_t_4 = __pyx_f_8pysndlib_3clm_check_ndim(__pyx_v_amps, 0, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2044, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+2045: amps_view = amps
__pyx_t_1 = __Pyx_PyObject_to_MemoryviewSlice_ds_nn_mus_float_t(__pyx_v_amps, PyBUF_WRITABLE); if (unlikely(!__pyx_t_1.memview)) __PYX_ERR(0, 2045, __pyx_L1_error) __PYX_XCLEAR_MEMVIEW(&__pyx_v_amps_view, 1); __pyx_v_amps_view = __pyx_t_1; __pyx_t_1.memview = NULL; __pyx_t_1.data = NULL;
+2046: gen = mus_any.from_ptr(cclm.mus_make_oscil_bank(len(freqs), &freqs_view[0], &phases_view[0], &s_view[0], stable))
__pyx_t_8 = PyObject_Length(__pyx_v_freqs); if (unlikely(__pyx_t_8 == ((Py_ssize_t)-1))) __PYX_ERR(0, 2046, __pyx_L1_error) __pyx_t_9 = 0; __pyx_t_10 = -1; if (__pyx_t_9 < 0) { __pyx_t_9 += __pyx_v_freqs_view.shape[0]; if (unlikely(__pyx_t_9 < 0)) __pyx_t_10 = 0; } else if (unlikely(__pyx_t_9 >= __pyx_v_freqs_view.shape[0])) __pyx_t_10 = 0; if (unlikely(__pyx_t_10 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_10); __PYX_ERR(0, 2046, __pyx_L1_error) } __pyx_t_11 = 0; __pyx_t_10 = -1; if (__pyx_t_11 < 0) { __pyx_t_11 += __pyx_v_phases_view.shape[0]; if (unlikely(__pyx_t_11 < 0)) __pyx_t_10 = 0; } else if (unlikely(__pyx_t_11 >= __pyx_v_phases_view.shape[0])) __pyx_t_10 = 0; if (unlikely(__pyx_t_10 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_10); __PYX_ERR(0, 2046, __pyx_L1_error) } __pyx_t_12 = 0; __pyx_t_10 = -1; if (__pyx_t_12 < 0) { __pyx_t_12 += __pyx_v_amps_view.shape[0]; if (unlikely(__pyx_t_12 < 0)) __pyx_t_10 = 0; } else if (unlikely(__pyx_t_12 >= __pyx_v_amps_view.shape[0])) __pyx_t_10 = 0; if (unlikely(__pyx_t_10 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_10); __PYX_ERR(0, 2046, __pyx_L1_error) } __pyx_t_4 = ((PyObject *)__pyx_vtabptr_8pysndlib_3clm_mus_any->from_ptr(mus_make_oscil_bank(__pyx_t_8, (&(*((mus_float_t *) ( /* dim=0 */ (__pyx_v_freqs_view.data + __pyx_t_9 * __pyx_v_freqs_view.strides[0]) )))), (&(*((mus_float_t *) ( /* dim=0 */ (__pyx_v_phases_view.data + __pyx_t_11 * __pyx_v_phases_view.strides[0]) )))), (&(*((mus_float_t *) ( /* dim=0 */ (__pyx_v_amps_view.data + __pyx_t_12 * __pyx_v_amps_view.strides[0]) )))), __pyx_v_stable), NULL)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2046, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_t_4); __pyx_t_4 = 0;
2047: else:
+2048: gen = mus_any.from_ptr(cclm.mus_make_oscil_bank(len(freqs), &freqs_view[0], &phases_view[0], NULL, stable))
/*else*/ {
__pyx_t_8 = PyObject_Length(__pyx_v_freqs); if (unlikely(__pyx_t_8 == ((Py_ssize_t)-1))) __PYX_ERR(0, 2048, __pyx_L1_error)
__pyx_t_12 = 0;
__pyx_t_10 = -1;
if (__pyx_t_12 < 0) {
__pyx_t_12 += __pyx_v_freqs_view.shape[0];
if (unlikely(__pyx_t_12 < 0)) __pyx_t_10 = 0;
} else if (unlikely(__pyx_t_12 >= __pyx_v_freqs_view.shape[0])) __pyx_t_10 = 0;
if (unlikely(__pyx_t_10 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_10);
__PYX_ERR(0, 2048, __pyx_L1_error)
}
__pyx_t_11 = 0;
__pyx_t_10 = -1;
if (__pyx_t_11 < 0) {
__pyx_t_11 += __pyx_v_phases_view.shape[0];
if (unlikely(__pyx_t_11 < 0)) __pyx_t_10 = 0;
} else if (unlikely(__pyx_t_11 >= __pyx_v_phases_view.shape[0])) __pyx_t_10 = 0;
if (unlikely(__pyx_t_10 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_10);
__PYX_ERR(0, 2048, __pyx_L1_error)
}
__pyx_t_4 = ((PyObject *)__pyx_vtabptr_8pysndlib_3clm_mus_any->from_ptr(mus_make_oscil_bank(__pyx_t_8, (&(*((mus_float_t *) ( /* dim=0 */ (__pyx_v_freqs_view.data + __pyx_t_12 * __pyx_v_freqs_view.strides[0]) )))), (&(*((mus_float_t *) ( /* dim=0 */ (__pyx_v_phases_view.data + __pyx_t_11 * __pyx_v_phases_view.strides[0]) )))), NULL, __pyx_v_stable), NULL)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2048, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_t_4);
__pyx_t_4 = 0;
}
__pyx_L5:;
2049:
+2050: gen.cache_extend([freqs, phases, amps])
__pyx_t_4 = PyList_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2050, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_INCREF(__pyx_v_freqs); __Pyx_GIVEREF(__pyx_v_freqs); if (__Pyx_PyList_SET_ITEM(__pyx_t_4, 0, __pyx_v_freqs)) __PYX_ERR(0, 2050, __pyx_L1_error); __Pyx_INCREF(__pyx_v_phases); __Pyx_GIVEREF(__pyx_v_phases); if (__Pyx_PyList_SET_ITEM(__pyx_t_4, 1, __pyx_v_phases)) __PYX_ERR(0, 2050, __pyx_L1_error); __Pyx_INCREF(__pyx_v_amps); __Pyx_GIVEREF(__pyx_v_amps); if (__Pyx_PyList_SET_ITEM(__pyx_t_4, 2, __pyx_v_amps)) __PYX_ERR(0, 2050, __pyx_L1_error); __pyx_t_7 = ((struct __pyx_vtabstruct_8pysndlib_3clm_mus_any *)__pyx_v_gen->__pyx_vtab)->cache_extend(__pyx_v_gen, __pyx_t_4, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2050, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+2051: return gen
__Pyx_XDECREF((PyObject *)__pyx_r); __Pyx_INCREF((PyObject *)__pyx_v_gen); __pyx_r = __pyx_v_gen; goto __pyx_L0;
2052:
+2053: cpdef cython.double oscil_bank(mus_any gen):
static PyObject *__pyx_pw_8pysndlib_3clm_149oscil_bank(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static double __pyx_f_8pysndlib_3clm_oscil_bank(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, CYTHON_UNUSED int __pyx_skip_dispatch) {
double __pyx_r;
/* … */
/* function exit code */
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_149oscil_bank(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_148oscil_bank, "\n sum an array of oscils\n \n :param gen: oscil_bank gen\n :rtype: float\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_149oscil_bank = {"oscil_bank", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_149oscil_bank, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_148oscil_bank};
static PyObject *__pyx_pw_8pysndlib_3clm_149oscil_bank(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("oscil_bank (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gen,0};
PyObject* values[1] = {0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_gen)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2053, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "oscil_bank") < 0)) __PYX_ERR(0, 2053, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 1)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
}
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)values[0]);
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("oscil_bank", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 2053, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.oscil_bank", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gen), __pyx_ptype_8pysndlib_3clm_mus_any, 1, "gen", 0))) __PYX_ERR(0, 2053, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_148oscil_bank(__pyx_self, __pyx_v_gen);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_148oscil_bank(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8pysndlib_3clm_oscil_bank(__pyx_v_gen, 0); if (unlikely(__pyx_t_1 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2053, __pyx_L1_error)
__pyx_t_2 = PyFloat_FromDouble(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2053, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("pysndlib.clm.oscil_bank", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_149oscil_bank, 0, __pyx_n_s_oscil_bank, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__276)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 2053, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_oscil_bank, __pyx_t_40) < 0) __PYX_ERR(0, 2053, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
/* … */
__pyx_codeobj__276 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__56, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_oscil_bank, 2053, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__276)) __PYX_ERR(0, 2053, __pyx_L1_error)
2054: """
2055: sum an array of oscils
2056:
2057: :param gen: oscil_bank gen
2058: :rtype: float
2059: """
+2060: return cclm.mus_oscil_bank(gen._ptr)
__pyx_r = mus_oscil_bank(__pyx_v_gen->_ptr); goto __pyx_L0;
2061:
+2062: cpdef bint is_oscil_bank(mus_any gen):
static PyObject *__pyx_pw_8pysndlib_3clm_151is_oscil_bank(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static int __pyx_f_8pysndlib_3clm_is_oscil_bank(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, CYTHON_UNUSED int __pyx_skip_dispatch) {
int __pyx_r;
/* … */
/* function exit code */
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_151is_oscil_bank(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_150is_oscil_bank, "\n returns True if gen is an oscil_bank\n \n :param gen: gen\n :rtype: bool\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_151is_oscil_bank = {"is_oscil_bank", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_151is_oscil_bank, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_150is_oscil_bank};
static PyObject *__pyx_pw_8pysndlib_3clm_151is_oscil_bank(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("is_oscil_bank (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gen,0};
PyObject* values[1] = {0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_gen)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2062, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "is_oscil_bank") < 0)) __PYX_ERR(0, 2062, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 1)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
}
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)values[0]);
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("is_oscil_bank", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 2062, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.is_oscil_bank", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gen), __pyx_ptype_8pysndlib_3clm_mus_any, 1, "gen", 0))) __PYX_ERR(0, 2062, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_150is_oscil_bank(__pyx_self, __pyx_v_gen);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_150is_oscil_bank(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8pysndlib_3clm_is_oscil_bank(__pyx_v_gen, 0); if (unlikely(__pyx_t_1 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2062, __pyx_L1_error)
__pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2062, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("pysndlib.clm.is_oscil_bank", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_151is_oscil_bank, 0, __pyx_n_s_is_oscil_bank, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__277)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 2062, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_is_oscil_bank, __pyx_t_40) < 0) __PYX_ERR(0, 2062, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
/* … */
__pyx_codeobj__277 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__56, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_is_oscil_bank, 2062, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__277)) __PYX_ERR(0, 2062, __pyx_L1_error)
2063: """
2064: returns True if gen is an oscil_bank
2065:
2066: :param gen: gen
2067: :rtype: bool
2068: """
+2069: return cclm.mus_is_oscil_bank(gen._ptr)
__pyx_r = mus_is_oscil_bank(__pyx_v_gen->_ptr); goto __pyx_L0;
2070:
2071:
2072:
2073:
2074: # ---------------- env ---------------- #
+2075: cpdef mus_any make_env(envelope, cython.double scaler=1.0, cython.double duration=1.0, cython.double offset=0.0, cython.double base=1.0, cython.int length=0):
static PyObject *__pyx_pw_8pysndlib_3clm_153make_env(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_f_8pysndlib_3clm_make_env(PyObject *__pyx_v_envelope, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_8pysndlib_3clm_make_env *__pyx_optional_args) {
double __pyx_v_scaler = ((double)1.0);
double __pyx_v_duration = ((double)1.0);
double __pyx_v_offset = ((double)0.0);
double __pyx_v_base = ((double)1.0);
int __pyx_v_length = ((int)0);
__Pyx_memviewslice __pyx_v_envelope_view = { 0, 0, { 0 }, { 0 }, { 0 } };
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = NULL;
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_r = NULL;
if (__pyx_optional_args) {
if (__pyx_optional_args->__pyx_n > 0) {
__pyx_v_scaler = __pyx_optional_args->scaler;
if (__pyx_optional_args->__pyx_n > 1) {
__pyx_v_duration = __pyx_optional_args->duration;
if (__pyx_optional_args->__pyx_n > 2) {
__pyx_v_offset = __pyx_optional_args->offset;
if (__pyx_optional_args->__pyx_n > 3) {
__pyx_v_base = __pyx_optional_args->base;
if (__pyx_optional_args->__pyx_n > 4) {
__pyx_v_length = __pyx_optional_args->length;
}
}
}
}
}
}
__Pyx_INCREF(__pyx_v_envelope);
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_8);
__Pyx_XDECREF(__pyx_t_9);
__PYX_XCLEAR_MEMVIEW(&__pyx_t_10, 1);
__Pyx_AddTraceback("pysndlib.clm.make_env", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__PYX_XCLEAR_MEMVIEW(&__pyx_v_envelope_view, 1);
__Pyx_XDECREF((PyObject *)__pyx_v_gen);
__Pyx_XDECREF(__pyx_v_envelope);
__Pyx_XGIVEREF((PyObject *)__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_153make_env(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_152make_env, "\n return a new envelope generator. 'envelope' is a list/array of break-point pairs. to create the\n envelope, these points are offset by 'offset', scaled by 'scaler', and mapped over the time interval\n defined by either 'duration' (seconds) or 'length' (samples). if 'base' is 1.0, the connecting segments\n are linear, if 0.0 you get a step function, and anything else produces an exponential connecting segment.\n \n :param envelope: list or np.ndarry of breakpoint pairs\n :param scaler: scaler on every y value (before offset is added)\n :param duration: duration \\in seconds\n :param offset: value added to every y value\n :param base: type of connecting line between break-points\n :param length: duration \\in samples\n :result: env gen\n :rtype: mus_any\n\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_153make_env = {"make_env", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_153make_env, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_152make_env};
static PyObject *__pyx_pw_8pysndlib_3clm_153make_env(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
PyObject *__pyx_v_envelope = 0;
double __pyx_v_scaler;
double __pyx_v_duration;
double __pyx_v_offset;
double __pyx_v_base;
int __pyx_v_length;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("make_env (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_envelope,&__pyx_n_s_scaler,&__pyx_n_s_duration,&__pyx_n_s_offset,&__pyx_n_s_base,&__pyx_n_s_length,0};
PyObject* values[6] = {0,0,0,0,0,0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 6: values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5);
CYTHON_FALLTHROUGH;
case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4);
CYTHON_FALLTHROUGH;
case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
CYTHON_FALLTHROUGH;
case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_envelope)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2075, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_scaler);
if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2075, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 2:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_duration);
if (value) { values[2] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2075, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 3:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_offset);
if (value) { values[3] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2075, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 4:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_base);
if (value) { values[4] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2075, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 5:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_length);
if (value) { values[5] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2075, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "make_env") < 0)) __PYX_ERR(0, 2075, __pyx_L3_error)
}
} else {
switch (__pyx_nargs) {
case 6: values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5);
CYTHON_FALLTHROUGH;
case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4);
CYTHON_FALLTHROUGH;
case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
CYTHON_FALLTHROUGH;
case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
break;
default: goto __pyx_L5_argtuple_error;
}
}
__pyx_v_envelope = values[0];
if (values[1]) {
__pyx_v_scaler = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_scaler == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2075, __pyx_L3_error)
} else {
__pyx_v_scaler = ((double)1.0);
}
if (values[2]) {
__pyx_v_duration = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_duration == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2075, __pyx_L3_error)
} else {
__pyx_v_duration = ((double)1.0);
}
if (values[3]) {
__pyx_v_offset = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_offset == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2075, __pyx_L3_error)
} else {
__pyx_v_offset = ((double)0.0);
}
if (values[4]) {
__pyx_v_base = __pyx_PyFloat_AsDouble(values[4]); if (unlikely((__pyx_v_base == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2075, __pyx_L3_error)
} else {
__pyx_v_base = ((double)1.0);
}
if (values[5]) {
__pyx_v_length = __Pyx_PyInt_As_int(values[5]); if (unlikely((__pyx_v_length == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2075, __pyx_L3_error)
} else {
__pyx_v_length = ((int)0);
}
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("make_env", 0, 1, 6, __pyx_nargs); __PYX_ERR(0, 2075, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.make_env", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_8pysndlib_3clm_152make_env(__pyx_self, __pyx_v_envelope, __pyx_v_scaler, __pyx_v_duration, __pyx_v_offset, __pyx_v_base, __pyx_v_length);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_152make_env(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_envelope, double __pyx_v_scaler, double __pyx_v_duration, double __pyx_v_offset, double __pyx_v_base, int __pyx_v_length) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_2.__pyx_n = 5;
__pyx_t_2.scaler = __pyx_v_scaler;
__pyx_t_2.duration = __pyx_v_duration;
__pyx_t_2.offset = __pyx_v_offset;
__pyx_t_2.base = __pyx_v_base;
__pyx_t_2.length = __pyx_v_length;
__pyx_t_1 = ((PyObject *)__pyx_f_8pysndlib_3clm_make_env(__pyx_v_envelope, 0, &__pyx_t_2)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2075, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("pysndlib.clm.make_env", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_tuple__278 = PyTuple_Pack(6, __pyx_n_s_envelope, __pyx_n_s_scaler, __pyx_n_s_duration, __pyx_n_s_offset, __pyx_n_s_base, __pyx_n_s_length); if (unlikely(!__pyx_tuple__278)) __PYX_ERR(0, 2075, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__278);
__Pyx_GIVEREF(__pyx_tuple__278);
__pyx_codeobj__279 = (PyObject*)__Pyx_PyCode_New(6, 0, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__278, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_make_env, 2075, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__279)) __PYX_ERR(0, 2075, __pyx_L1_error)
/* … */
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_153make_env, 0, __pyx_n_s_make_env, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__279)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 2075, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
__Pyx_CyFunction_SetDefaultsTuple(__pyx_t_40, __pyx_tuple__280);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_make_env, __pyx_t_40) < 0) __PYX_ERR(0, 2075, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
__pyx_tuple__280 = PyTuple_Pack(5, __pyx_float_1_0, __pyx_float_1_0, __pyx_float_0_0, __pyx_float_1_0, __pyx_int_0); if (unlikely(!__pyx_tuple__280)) __PYX_ERR(0, 2075, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__280);
__Pyx_GIVEREF(__pyx_tuple__280);
/* … */
struct __pyx_opt_args_8pysndlib_3clm_make_env {
int __pyx_n;
double scaler;
double duration;
double offset;
double base;
int length;
};
2076: """
2077: return a new envelope generator. 'envelope' is a list/array of break-point pairs. to create the
2078: envelope, these points are offset by 'offset', scaled by 'scaler', and mapped over the time interval
2079: defined by either 'duration' (seconds) or 'length' (samples). if 'base' is 1.0, the connecting segments
2080: are linear, if 0.0 you get a step function, and anything else produces an exponential connecting segment.
2081:
2082: :param envelope: list or np.ndarry of breakpoint pairs
2083: :param scaler: scaler on every y value (before offset is added)
2084: :param duration: duration \in seconds
2085: :param offset: value added to every y value
2086: :param base: type of connecting line between break-points
2087: :param length: duration \in samples
2088: :result: env gen
2089: :rtype: mus_any
2090:
2091: """
+2092: validate_envelope(envelope)
__Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_validate_envelope); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2092, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = NULL; __pyx_t_4 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_2))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); __pyx_t_4 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v_envelope}; __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2092, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+2093: check_range('duration', duration, 0.0, None)
__pyx_t_1 = PyFloat_FromDouble(__pyx_v_duration); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2093, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_5.__pyx_n = 2; __pyx_t_5.low = __pyx_float_0_0; __pyx_t_5.high = Py_None; __pyx_t_2 = __pyx_f_8pysndlib_3clm_check_range(__pyx_n_s_duration, __pyx_t_1, 0, &__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2093, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2094:
+2095: if length > 0:
__pyx_t_6 = (__pyx_v_length > 0);
if (__pyx_t_6) {
/* … */
}
+2096: duration = samples2seconds(length)
__pyx_t_7 = __pyx_f_8pysndlib_3clm_samples2seconds(__pyx_v_length, 0); if (unlikely(__pyx_t_7 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2096, __pyx_L1_error) __pyx_v_duration = __pyx_t_7;
2097:
+2098: if isinstance(envelope, list):
__pyx_t_6 = PyList_Check(__pyx_v_envelope);
if (__pyx_t_6) {
/* … */
}
+2099: envelope = np.array(envelope, dtype=np.double)
__Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2099, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_array); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2099, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2099, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_v_envelope); __Pyx_GIVEREF(__pyx_v_envelope); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_envelope)) __PYX_ERR(0, 2099, __pyx_L1_error); __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2099, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2099, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_double); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2099, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_dtype, __pyx_t_9) < 0) __PYX_ERR(0, 2099, __pyx_L1_error) __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2099, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF_SET(__pyx_v_envelope, __pyx_t_9); __pyx_t_9 = 0;
2100:
+2101: check_ndim(envelope)
__pyx_t_9 = __pyx_f_8pysndlib_3clm_check_ndim(__pyx_v_envelope, 0, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2101, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
2102:
+2103: cdef double [:] envelope_view = envelope
__pyx_t_10 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_v_envelope, PyBUF_WRITABLE); if (unlikely(!__pyx_t_10.memview)) __PYX_ERR(0, 2103, __pyx_L1_error) __pyx_v_envelope_view = __pyx_t_10; __pyx_t_10.memview = NULL; __pyx_t_10.data = NULL;
+2104: gen = mus_any.from_ptr(cclm.mus_make_env(&envelope_view[0], len(envelope) // 2, scaler, offset, base, duration, 0, NULL),owner=True, length=len(envelope))
__pyx_t_11 = 0;
__pyx_t_4 = -1;
if (__pyx_t_11 < 0) {
__pyx_t_11 += __pyx_v_envelope_view.shape[0];
if (unlikely(__pyx_t_11 < 0)) __pyx_t_4 = 0;
} else if (unlikely(__pyx_t_11 >= __pyx_v_envelope_view.shape[0])) __pyx_t_4 = 0;
if (unlikely(__pyx_t_4 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_4);
__PYX_ERR(0, 2104, __pyx_L1_error)
}
__pyx_t_12 = PyObject_Length(__pyx_v_envelope); if (unlikely(__pyx_t_12 == ((Py_ssize_t)-1))) __PYX_ERR(0, 2104, __pyx_L1_error)
__pyx_t_13 = PyObject_Length(__pyx_v_envelope); if (unlikely(__pyx_t_13 == ((Py_ssize_t)-1))) __PYX_ERR(0, 2104, __pyx_L1_error)
__pyx_t_14.__pyx_n = 2;
__pyx_t_14.owner = 1;
__pyx_t_14.length = __pyx_t_13;
__pyx_t_9 = ((PyObject *)__pyx_vtabptr_8pysndlib_3clm_mus_any->from_ptr(mus_make_env((&(*((double *) ( /* dim=0 */ (__pyx_v_envelope_view.data + __pyx_t_11 * __pyx_v_envelope_view.strides[0]) )))), __Pyx_div_Py_ssize_t(__pyx_t_12, 2), __pyx_v_scaler, __pyx_v_offset, __pyx_v_base, __pyx_v_duration, 0, NULL), &__pyx_t_14)); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2104, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_9);
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_t_9);
__pyx_t_9 = 0;
+2105: gen.cache_append(envelope)
__pyx_t_9 = ((struct __pyx_vtabstruct_8pysndlib_3clm_mus_any *)__pyx_v_gen->__pyx_vtab)->cache_append(__pyx_v_gen, __pyx_v_envelope, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2105, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+2106: return gen
__Pyx_XDECREF((PyObject *)__pyx_r); __Pyx_INCREF((PyObject *)__pyx_v_gen); __pyx_r = __pyx_v_gen; goto __pyx_L0;
2107:
+2108: cpdef cython.double env(mus_any gen ):
static PyObject *__pyx_pw_8pysndlib_3clm_155env(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static double __pyx_f_8pysndlib_3clm_env(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, CYTHON_UNUSED int __pyx_skip_dispatch) {
double __pyx_r;
/* … */
/* function exit code */
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_155env(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_154env, "\n next sample from envelope generator.\n \n :param gen: env gen\n :rtype: float\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_155env = {"env", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_155env, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_154env};
static PyObject *__pyx_pw_8pysndlib_3clm_155env(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("env (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gen,0};
PyObject* values[1] = {0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_gen)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2108, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "env") < 0)) __PYX_ERR(0, 2108, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 1)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
}
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)values[0]);
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("env", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 2108, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.env", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gen), __pyx_ptype_8pysndlib_3clm_mus_any, 1, "gen", 0))) __PYX_ERR(0, 2108, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_154env(__pyx_self, __pyx_v_gen);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_154env(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8pysndlib_3clm_env(__pyx_v_gen, 0); if (unlikely(__pyx_t_1 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2108, __pyx_L1_error)
__pyx_t_2 = PyFloat_FromDouble(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2108, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("pysndlib.clm.env", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_155env, 0, __pyx_n_s_env, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__281)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 2108, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_env, __pyx_t_40) < 0) __PYX_ERR(0, 2108, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
/* … */
__pyx_codeobj__281 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__56, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_env, 2108, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__281)) __PYX_ERR(0, 2108, __pyx_L1_error)
2109: """
2110: next sample from envelope generator.
2111:
2112: :param gen: env gen
2113: :rtype: float
2114: """
+2115: return cclm.mus_env(gen._ptr)
__pyx_r = mus_env(__pyx_v_gen->_ptr); goto __pyx_L0;
2116:
+2117: cpdef bint is_env(mus_any gen):
static PyObject *__pyx_pw_8pysndlib_3clm_157is_env(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static int __pyx_f_8pysndlib_3clm_is_env(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, CYTHON_UNUSED int __pyx_skip_dispatch) {
int __pyx_r;
/* … */
/* function exit code */
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_157is_env(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_156is_env, "\n returns True if gen is an env.\n \n :param gen: gen\n :rtype: bool\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_157is_env = {"is_env", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_157is_env, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_156is_env};
static PyObject *__pyx_pw_8pysndlib_3clm_157is_env(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("is_env (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gen,0};
PyObject* values[1] = {0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_gen)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2117, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "is_env") < 0)) __PYX_ERR(0, 2117, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 1)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
}
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)values[0]);
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("is_env", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 2117, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.is_env", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gen), __pyx_ptype_8pysndlib_3clm_mus_any, 1, "gen", 0))) __PYX_ERR(0, 2117, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_156is_env(__pyx_self, __pyx_v_gen);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_156is_env(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8pysndlib_3clm_is_env(__pyx_v_gen, 0); if (unlikely(__pyx_t_1 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2117, __pyx_L1_error)
__pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2117, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("pysndlib.clm.is_env", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_157is_env, 0, __pyx_n_s_is_env, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__282)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 2117, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_is_env, __pyx_t_40) < 0) __PYX_ERR(0, 2117, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
/* … */
__pyx_codeobj__282 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__56, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_is_env, 2117, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__282)) __PYX_ERR(0, 2117, __pyx_L1_error)
2118: """
2119: returns True if gen is an env.
2120:
2121: :param gen: gen
2122: :rtype: bool
2123: """
+2124: return cclm.mus_is_env(gen._ptr)
__pyx_r = mus_is_env(__pyx_v_gen->_ptr); goto __pyx_L0;
2125:
+2126: cpdef cython.double env_interp(cython.double x , mus_any env):
static PyObject *__pyx_pw_8pysndlib_3clm_159env_interp(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static double __pyx_f_8pysndlib_3clm_env_interp(double __pyx_v_x, struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_env, CYTHON_UNUSED int __pyx_skip_dispatch) {
double __pyx_r;
/* … */
/* function exit code */
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_159env_interp(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_158env_interp, "\n value of envelope env at x.\n \n :param x: location \\in envelope\n :param env: env gen\n :rtype: float\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_159env_interp = {"env_interp", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_159env_interp, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_158env_interp};
static PyObject *__pyx_pw_8pysndlib_3clm_159env_interp(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
double __pyx_v_x;
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_env = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("env_interp (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_env,0};
PyObject* values[2] = {0,0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_x)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2126, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_env)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2126, __pyx_L3_error)
else {
__Pyx_RaiseArgtupleInvalid("env_interp", 1, 2, 2, 1); __PYX_ERR(0, 2126, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "env_interp") < 0)) __PYX_ERR(0, 2126, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 2)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
}
__pyx_v_x = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_x == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2126, __pyx_L3_error)
__pyx_v_env = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)values[1]);
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("env_interp", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 2126, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.env_interp", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_env), __pyx_ptype_8pysndlib_3clm_mus_any, 1, "env", 0))) __PYX_ERR(0, 2126, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_158env_interp(__pyx_self, __pyx_v_x, __pyx_v_env);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_158env_interp(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_x, struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_env) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8pysndlib_3clm_env_interp(__pyx_v_x, __pyx_v_env, 0); if (unlikely(__pyx_t_1 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2126, __pyx_L1_error)
__pyx_t_2 = PyFloat_FromDouble(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2126, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("pysndlib.clm.env_interp", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_tuple__283 = PyTuple_Pack(2, __pyx_n_s_x, __pyx_n_s_env); if (unlikely(!__pyx_tuple__283)) __PYX_ERR(0, 2126, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__283);
__Pyx_GIVEREF(__pyx_tuple__283);
/* … */
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_159env_interp, 0, __pyx_n_s_env_interp, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__284)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 2126, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_env_interp, __pyx_t_40) < 0) __PYX_ERR(0, 2126, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
__pyx_codeobj__284 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__283, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_env_interp, 2126, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__284)) __PYX_ERR(0, 2126, __pyx_L1_error)
2127: """
2128: value of envelope env at x.
2129:
2130: :param x: location \in envelope
2131: :param env: env gen
2132: :rtype: float
2133: """
+2134: return cclm.mus_env_interp(x, env._ptr)
__pyx_r = mus_env_interp(__pyx_v_x, __pyx_v_env->_ptr); goto __pyx_L0;
2135:
+2136: cpdef cython.double envelope_interp(cython.double x , mus_any env):
static PyObject *__pyx_pw_8pysndlib_3clm_161envelope_interp(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static double __pyx_f_8pysndlib_3clm_envelope_interp(double __pyx_v_x, struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_env, CYTHON_UNUSED int __pyx_skip_dispatch) {
double __pyx_r;
/* … */
/* function exit code */
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_161envelope_interp(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_160envelope_interp, "\n value of envelope env at x.\n \n :param x: location \\in envelope\n :param env: env gen\n :rtype: float\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_161envelope_interp = {"envelope_interp", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_161envelope_interp, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_160envelope_interp};
static PyObject *__pyx_pw_8pysndlib_3clm_161envelope_interp(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
double __pyx_v_x;
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_env = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("envelope_interp (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_env,0};
PyObject* values[2] = {0,0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_x)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2136, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_env)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2136, __pyx_L3_error)
else {
__Pyx_RaiseArgtupleInvalid("envelope_interp", 1, 2, 2, 1); __PYX_ERR(0, 2136, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "envelope_interp") < 0)) __PYX_ERR(0, 2136, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 2)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
}
__pyx_v_x = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_x == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2136, __pyx_L3_error)
__pyx_v_env = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)values[1]);
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("envelope_interp", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 2136, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.envelope_interp", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_env), __pyx_ptype_8pysndlib_3clm_mus_any, 1, "env", 0))) __PYX_ERR(0, 2136, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_160envelope_interp(__pyx_self, __pyx_v_x, __pyx_v_env);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_160envelope_interp(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_x, struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_env) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8pysndlib_3clm_envelope_interp(__pyx_v_x, __pyx_v_env, 0); if (unlikely(__pyx_t_1 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2136, __pyx_L1_error)
__pyx_t_2 = PyFloat_FromDouble(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2136, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("pysndlib.clm.envelope_interp", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_161envelope_interp, 0, __pyx_n_s_envelope_interp, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__285)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 2136, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_envelope_interp, __pyx_t_40) < 0) __PYX_ERR(0, 2136, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
/* … */
__pyx_codeobj__285 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__283, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_envelope_interp, 2136, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__285)) __PYX_ERR(0, 2136, __pyx_L1_error)
2137: """
2138: value of envelope env at x.
2139:
2140: :param x: location \in envelope
2141: :param env: env gen
2142: :rtype: float
2143: """
+2144: return cclm.mus_env_interp(x, env._ptr)
__pyx_r = mus_env_interp(__pyx_v_x, __pyx_v_env->_ptr); goto __pyx_L0;
2145:
2146:
2147: # #mus_env_rates
+2148: cpdef np.ndarray env_rates(gen: mus_any):
static PyObject *__pyx_pw_8pysndlib_3clm_163env_rates(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyArrayObject *__pyx_f_8pysndlib_3clm_env_rates(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, CYTHON_UNUSED int __pyx_skip_dispatch) {
struct __pyx_array_obj *__pyx_v_arr = 0;
mus_long_t __pyx_v_size;
mus_float_t *__pyx_v_rates_ptr;
PyArrayObject *__pyx_r = NULL;
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_AddTraceback("pysndlib.clm.env_rates", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XDECREF((PyObject *)__pyx_v_arr);
__Pyx_XGIVEREF((PyObject *)__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_163env_rates(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_8pysndlib_3clm_163env_rates = {"env_rates", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_163env_rates, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_8pysndlib_3clm_163env_rates(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("env_rates (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gen,0};
PyObject* values[1] = {0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_gen)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2148, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "env_rates") < 0)) __PYX_ERR(0, 2148, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 1)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
}
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)values[0]);
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("env_rates", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 2148, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.env_rates", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gen), __pyx_ptype_8pysndlib_3clm_mus_any, 0, "gen", 0))) __PYX_ERR(0, 2148, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_162env_rates(__pyx_self, __pyx_v_gen);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_162env_rates(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = ((PyObject *)__pyx_f_8pysndlib_3clm_env_rates(__pyx_v_gen, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2148, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("pysndlib.clm.env_rates", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_40 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 2148, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
if (PyDict_SetItem(__pyx_t_40, __pyx_n_s_gen, __pyx_n_s_mus_any) < 0) __PYX_ERR(0, 2148, __pyx_L1_error)
__pyx_t_43 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_163env_rates, 0, __pyx_n_s_env_rates, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__286)); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 2148, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
__Pyx_CyFunction_SetAnnotationsDict(__pyx_t_43, __pyx_t_40);
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
if (PyDict_SetItem(__pyx_d, __pyx_n_s_env_rates, __pyx_t_43) < 0) __PYX_ERR(0, 2148, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
/* … */
__pyx_codeobj__286 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__56, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_env_rates, 2148, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__286)) __PYX_ERR(0, 2148, __pyx_L1_error)
+2149: cdef view.array arr = None
__Pyx_INCREF(Py_None);
__pyx_v_arr = ((struct __pyx_array_obj *)Py_None);
+2150: cdef cclm.mus_long_t size = cclm.mus_length(gen._ptr)
__pyx_v_size = mus_length(__pyx_v_gen->_ptr);
+2151: cdef cclm.mus_float_t* rates_ptr = cclm.mus_env_rates(gen._ptr)
__pyx_v_rates_ptr = mus_env_rates(__pyx_v_gen->_ptr);
+2152: arr = view.array(shape=(size,),itemsize=sizeof(double), format='d', allocate_buffer=False)
__pyx_t_1 = __Pyx_PyDict_NewPresized(4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2152, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyInt_From_int64_t(__pyx_v_size); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2152, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2152, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_GIVEREF(__pyx_t_2); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2)) __PYX_ERR(0, 2152, __pyx_L1_error); __pyx_t_2 = 0; if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_shape, __pyx_t_3) < 0) __PYX_ERR(0, 2152, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = __Pyx_PyInt_FromSize_t((sizeof(double))); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2152, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_itemsize, __pyx_t_3) < 0) __PYX_ERR(0, 2152, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_format, __pyx_n_s_d) < 0) __PYX_ERR(0, 2152, __pyx_L1_error) if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_allocate_buffer, Py_False) < 0) __PYX_ERR(0, 2152, __pyx_L1_error) __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)__pyx_array_type), __pyx_empty_tuple, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2152, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF_SET(__pyx_v_arr, ((struct __pyx_array_obj *)__pyx_t_3)); __pyx_t_3 = 0;
+2153: arr.data = <char*>rates_ptr
__pyx_v_arr->data = ((char *)__pyx_v_rates_ptr);
+2154: return np.asarray(arr)
__Pyx_XDECREF((PyObject *)__pyx_r); __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2154, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_asarray); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2154, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = NULL; __pyx_t_4 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_2))) { __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_1)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_1); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); __pyx_t_4 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_1, ((PyObject *)__pyx_v_arr)}; __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4); __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2154, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 2154, __pyx_L1_error) __pyx_r = ((PyArrayObject *)__pyx_t_3); __pyx_t_3 = 0; goto __pyx_L0;
2155: #
2156:
2157:
2158: # this is slow because of needing ctypes to define function at runtime
2159: # but no other way to do it with cython without changing sndlib code
+2160: cpdef cython.double env_any(mus_any gen , connection_function):
static PyObject *__pyx_pw_8pysndlib_3clm_165env_any(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static double __pyx_f_8pysndlib_3clm_env_any(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, PyObject *__pyx_v_connection_function, CYTHON_UNUSED int __pyx_skip_dispatch) {
PyObject *__pyx_v_f = NULL;
connect_points_cb __pyx_v_cy_f_ptr;
double __pyx_r;
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_AddTraceback("pysndlib.clm.env_any", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = -1;
__pyx_L0:;
__Pyx_XDECREF(__pyx_v_f);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_165env_any(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_164env_any, "\n generate env output using conncection_func to 'connect the dots'.\n \n the env-any connecting function takes one argument, the current envelope value treated as going between 0.0 and 1.0 between each two points. \n :param env: env gen\n :param connection_function: function used to connect points\n :rtype: float\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_165env_any = {"env_any", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_165env_any, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_164env_any};
static PyObject *__pyx_pw_8pysndlib_3clm_165env_any(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = 0;
PyObject *__pyx_v_connection_function = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("env_any (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gen,&__pyx_n_s_connection_function,0};
PyObject* values[2] = {0,0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_gen)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2160, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_connection_function)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2160, __pyx_L3_error)
else {
__Pyx_RaiseArgtupleInvalid("env_any", 1, 2, 2, 1); __PYX_ERR(0, 2160, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "env_any") < 0)) __PYX_ERR(0, 2160, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 2)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
}
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)values[0]);
__pyx_v_connection_function = values[1];
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("env_any", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 2160, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.env_any", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gen), __pyx_ptype_8pysndlib_3clm_mus_any, 1, "gen", 0))) __PYX_ERR(0, 2160, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_164env_any(__pyx_self, __pyx_v_gen, __pyx_v_connection_function);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_164env_any(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, PyObject *__pyx_v_connection_function) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8pysndlib_3clm_env_any(__pyx_v_gen, __pyx_v_connection_function, 0); if (unlikely(__pyx_t_1 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2160, __pyx_L1_error)
__pyx_t_2 = PyFloat_FromDouble(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2160, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("pysndlib.clm.env_any", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_tuple__287 = PyTuple_Pack(2, __pyx_n_s_gen, __pyx_n_s_connection_function); if (unlikely(!__pyx_tuple__287)) __PYX_ERR(0, 2160, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__287);
__Pyx_GIVEREF(__pyx_tuple__287);
/* … */
__pyx_t_43 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_165env_any, 0, __pyx_n_s_env_any, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__288)); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 2160, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_env_any, __pyx_t_43) < 0) __PYX_ERR(0, 2160, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
__pyx_codeobj__288 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__287, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_env_any, 2160, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__288)) __PYX_ERR(0, 2160, __pyx_L1_error)
2161: """
2162: generate env output using conncection_func to 'connect the dots'.
2163:
2164: the env-any connecting function takes one argument, the current envelope value treated as going between 0.0 and 1.0 between each two points.
2165: :param env: env gen
2166: :param connection_function: function used to connect points
2167: :rtype: float
2168: """
2169:
+2170: f = ENVFUNCTION(connection_function)
__Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_ENVFUNCTION); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2170, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = NULL; __pyx_t_4 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_2))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); __pyx_t_4 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v_connection_function}; __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2170, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } __pyx_v_f = __pyx_t_1; __pyx_t_1 = 0;
+2171: cdef cclm.connect_points_cb cy_f_ptr = (<cclm.connect_points_cb*><size_t>ctypes.addressof(f))[0]
__Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_ctypes); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2171, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_addressof); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2171, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = NULL; __pyx_t_4 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_3))) { __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_2)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_2); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); __pyx_t_4 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_v_f}; __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2171, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } __pyx_t_5 = __Pyx_PyInt_As_size_t(__pyx_t_1); if (unlikely((__pyx_t_5 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 2171, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_cy_f_ptr = (((connect_points_cb *)((size_t)__pyx_t_5))[0]);
+2172: return cclm.mus_env_any(gen._ptr, cy_f_ptr)
__pyx_r = mus_env_any(__pyx_v_gen->_ptr, __pyx_v_cy_f_ptr); goto __pyx_L0;
2173:
2174:
2175: # ---------------- pulsed-env ---------------- #
+2176: cpdef mus_any make_pulsed_env(envelope, cython.double duration , cython.double frequency ):
static PyObject *__pyx_pw_8pysndlib_3clm_167make_pulsed_env(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_f_8pysndlib_3clm_make_pulsed_env(PyObject *__pyx_v_envelope, double __pyx_v_duration, double __pyx_v_frequency, CYTHON_UNUSED int __pyx_skip_dispatch) {
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_pl = NULL;
__Pyx_memviewslice __pyx_v_envelope_view = { 0, 0, { 0 }, { 0 }, { 0 } };
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_ge = NULL;
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = NULL;
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_r = NULL;
__Pyx_INCREF(__pyx_v_envelope);
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_XDECREF(__pyx_t_5);
__Pyx_XDECREF(__pyx_t_6);
__PYX_XCLEAR_MEMVIEW(&__pyx_t_7, 1);
__Pyx_AddTraceback("pysndlib.clm.make_pulsed_env", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XDECREF((PyObject *)__pyx_v_pl);
__PYX_XCLEAR_MEMVIEW(&__pyx_v_envelope_view, 1);
__Pyx_XDECREF((PyObject *)__pyx_v_ge);
__Pyx_XDECREF((PyObject *)__pyx_v_gen);
__Pyx_XDECREF(__pyx_v_envelope);
__Pyx_XGIVEREF((PyObject *)__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_167make_pulsed_env(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_166make_pulsed_env, "\n produces a repeating envelope. env sticks at its last value, but pulsed-env repeats it over and over. \n \n :param env: env gen\n :param duration: duration of envelope\n :param frequency: repetition rate \\in hz\n :return: env output\n :rtype: float\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_167make_pulsed_env = {"make_pulsed_env", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_167make_pulsed_env, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_166make_pulsed_env};
static PyObject *__pyx_pw_8pysndlib_3clm_167make_pulsed_env(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
PyObject *__pyx_v_envelope = 0;
double __pyx_v_duration;
double __pyx_v_frequency;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("make_pulsed_env (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_envelope,&__pyx_n_s_duration,&__pyx_n_s_frequency,0};
PyObject* values[3] = {0,0,0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_envelope)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2176, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_duration)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2176, __pyx_L3_error)
else {
__Pyx_RaiseArgtupleInvalid("make_pulsed_env", 1, 3, 3, 1); __PYX_ERR(0, 2176, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 2:
if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_frequency)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[2]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2176, __pyx_L3_error)
else {
__Pyx_RaiseArgtupleInvalid("make_pulsed_env", 1, 3, 3, 2); __PYX_ERR(0, 2176, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "make_pulsed_env") < 0)) __PYX_ERR(0, 2176, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 3)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
}
__pyx_v_envelope = values[0];
__pyx_v_duration = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_duration == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2176, __pyx_L3_error)
__pyx_v_frequency = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_frequency == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2176, __pyx_L3_error)
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("make_pulsed_env", 1, 3, 3, __pyx_nargs); __PYX_ERR(0, 2176, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.make_pulsed_env", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_8pysndlib_3clm_166make_pulsed_env(__pyx_self, __pyx_v_envelope, __pyx_v_duration, __pyx_v_frequency);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_166make_pulsed_env(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_envelope, double __pyx_v_duration, double __pyx_v_frequency) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = ((PyObject *)__pyx_f_8pysndlib_3clm_make_pulsed_env(__pyx_v_envelope, __pyx_v_duration, __pyx_v_frequency, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2176, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("pysndlib.clm.make_pulsed_env", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_tuple__289 = PyTuple_Pack(3, __pyx_n_s_envelope, __pyx_n_s_duration, __pyx_n_s_frequency); if (unlikely(!__pyx_tuple__289)) __PYX_ERR(0, 2176, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__289);
__Pyx_GIVEREF(__pyx_tuple__289);
/* … */
__pyx_t_43 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_167make_pulsed_env, 0, __pyx_n_s_make_pulsed_env, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__290)); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 2176, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_make_pulsed_env, __pyx_t_43) < 0) __PYX_ERR(0, 2176, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
__pyx_codeobj__290 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__289, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_make_pulsed_env, 2176, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__290)) __PYX_ERR(0, 2176, __pyx_L1_error)
2177: """
2178: produces a repeating envelope. env sticks at its last value, but pulsed-env repeats it over and over.
2179:
2180: :param env: env gen
2181: :param duration: duration of envelope
2182: :param frequency: repetition rate \in hz
2183: :return: env output
2184: :rtype: float
2185: """
2186:
+2187: if isinstance(envelope, list):
__pyx_t_1 = PyList_Check(__pyx_v_envelope);
if (__pyx_t_1) {
/* … */
}
+2188: envelope = np.array(envelope, dtype=np.double)
__Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2188, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_array); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2188, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2188, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_v_envelope); __Pyx_GIVEREF(__pyx_v_envelope); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_envelope)) __PYX_ERR(0, 2188, __pyx_L1_error); __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2188, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2188, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_double); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2188, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_dtype, __pyx_t_6) < 0) __PYX_ERR(0, 2188, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_2, __pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2188, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF_SET(__pyx_v_envelope, __pyx_t_6); __pyx_t_6 = 0;
2189:
+2190: pl = mus_any.from_ptr(cclm.mus_make_pulse_train(frequency, 1.0, 0.0))
__pyx_t_6 = ((PyObject *)__pyx_vtabptr_8pysndlib_3clm_mus_any->from_ptr(mus_make_pulse_train(__pyx_v_frequency, 1.0, 0.0), NULL)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2190, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_v_pl = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_t_6); __pyx_t_6 = 0;
2191:
+2192: check_ndim(envelope)
__pyx_t_6 = __pyx_f_8pysndlib_3clm_check_ndim(__pyx_v_envelope, 0, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2192, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
2193:
+2194: cdef double [:] envelope_view = envelope
__pyx_t_7 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_v_envelope, PyBUF_WRITABLE); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 2194, __pyx_L1_error) __pyx_v_envelope_view = __pyx_t_7; __pyx_t_7.memview = NULL; __pyx_t_7.data = NULL;
2195:
+2196: ge = mus_any.from_ptr(cclm.mus_make_env(&envelope_view[0], len(envelope) // 2, 1.0, 0, 1.0, duration, 0, NULL))
__pyx_t_8 = 0;
__pyx_t_9 = -1;
if (__pyx_t_8 < 0) {
__pyx_t_8 += __pyx_v_envelope_view.shape[0];
if (unlikely(__pyx_t_8 < 0)) __pyx_t_9 = 0;
} else if (unlikely(__pyx_t_8 >= __pyx_v_envelope_view.shape[0])) __pyx_t_9 = 0;
if (unlikely(__pyx_t_9 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_9);
__PYX_ERR(0, 2196, __pyx_L1_error)
}
__pyx_t_10 = PyObject_Length(__pyx_v_envelope); if (unlikely(__pyx_t_10 == ((Py_ssize_t)-1))) __PYX_ERR(0, 2196, __pyx_L1_error)
__pyx_t_6 = ((PyObject *)__pyx_vtabptr_8pysndlib_3clm_mus_any->from_ptr(mus_make_env((&(*((double *) ( /* dim=0 */ (__pyx_v_envelope_view.data + __pyx_t_8 * __pyx_v_envelope_view.strides[0]) )))), __Pyx_div_Py_ssize_t(__pyx_t_10, 2), 1.0, 0.0, 1.0, __pyx_v_duration, 0, NULL), NULL)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2196, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_6);
__pyx_v_ge = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_t_6);
__pyx_t_6 = 0;
+2197: gen = mus_any.from_ptr(cclm.mus_make_pulsed_env(ge._ptr, pl._ptr))
__pyx_t_6 = ((PyObject *)__pyx_vtabptr_8pysndlib_3clm_mus_any->from_ptr(mus_make_pulsed_env(__pyx_v_ge->_ptr, __pyx_v_pl->_ptr), NULL)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2197, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_t_6); __pyx_t_6 = 0;
+2198: gen.cache_extend([pl, ge, envelope])
__pyx_t_6 = PyList_New(3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2198, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_INCREF((PyObject *)__pyx_v_pl); __Pyx_GIVEREF((PyObject *)__pyx_v_pl); if (__Pyx_PyList_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_v_pl))) __PYX_ERR(0, 2198, __pyx_L1_error); __Pyx_INCREF((PyObject *)__pyx_v_ge); __Pyx_GIVEREF((PyObject *)__pyx_v_ge); if (__Pyx_PyList_SET_ITEM(__pyx_t_6, 1, ((PyObject *)__pyx_v_ge))) __PYX_ERR(0, 2198, __pyx_L1_error); __Pyx_INCREF(__pyx_v_envelope); __Pyx_GIVEREF(__pyx_v_envelope); if (__Pyx_PyList_SET_ITEM(__pyx_t_6, 2, __pyx_v_envelope)) __PYX_ERR(0, 2198, __pyx_L1_error); __pyx_t_4 = ((struct __pyx_vtabstruct_8pysndlib_3clm_mus_any *)__pyx_v_gen->__pyx_vtab)->cache_extend(__pyx_v_gen, __pyx_t_6, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2198, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+2199: return gen
__Pyx_XDECREF((PyObject *)__pyx_r); __Pyx_INCREF((PyObject *)__pyx_v_gen); __pyx_r = __pyx_v_gen; goto __pyx_L0;
2200:
+2201: cpdef cython.double pulsed_env(mus_any gen, cython.double fm=0.0):
static PyObject *__pyx_pw_8pysndlib_3clm_169pulsed_env(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static double __pyx_f_8pysndlib_3clm_pulsed_env(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_8pysndlib_3clm_pulsed_env *__pyx_optional_args) {
double __pyx_v_fm = ((double)0.0);
double __pyx_r;
if (__pyx_optional_args) {
if (__pyx_optional_args->__pyx_n > 0) {
__pyx_v_fm = __pyx_optional_args->fm;
}
}
/* … */
/* function exit code */
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_169pulsed_env(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_168pulsed_env, "\n next sample from envelope generator.\n \n :param gen: env gen\n :param fm: change frequency of repetition\n :rtype: float\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_169pulsed_env = {"pulsed_env", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_169pulsed_env, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_168pulsed_env};
static PyObject *__pyx_pw_8pysndlib_3clm_169pulsed_env(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = 0;
double __pyx_v_fm;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("pulsed_env (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gen,&__pyx_n_s_fm,0};
PyObject* values[2] = {0,0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_gen)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2201, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_fm);
if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2201, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "pulsed_env") < 0)) __PYX_ERR(0, 2201, __pyx_L3_error)
}
} else {
switch (__pyx_nargs) {
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
break;
default: goto __pyx_L5_argtuple_error;
}
}
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)values[0]);
if (values[1]) {
__pyx_v_fm = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_fm == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2201, __pyx_L3_error)
} else {
__pyx_v_fm = ((double)0.0);
}
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("pulsed_env", 0, 1, 2, __pyx_nargs); __PYX_ERR(0, 2201, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.pulsed_env", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gen), __pyx_ptype_8pysndlib_3clm_mus_any, 1, "gen", 0))) __PYX_ERR(0, 2201, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_168pulsed_env(__pyx_self, __pyx_v_gen, __pyx_v_fm);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_168pulsed_env(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, double __pyx_v_fm) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_2.__pyx_n = 1;
__pyx_t_2.fm = __pyx_v_fm;
__pyx_t_1 = __pyx_f_8pysndlib_3clm_pulsed_env(__pyx_v_gen, 0, &__pyx_t_2); if (unlikely(__pyx_t_1 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2201, __pyx_L1_error)
__pyx_t_3 = PyFloat_FromDouble(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2201, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__pyx_r = __pyx_t_3;
__pyx_t_3 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_3);
__Pyx_AddTraceback("pysndlib.clm.pulsed_env", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_tuple__291 = PyTuple_Pack(2, __pyx_n_s_gen, __pyx_n_s_fm); if (unlikely(!__pyx_tuple__291)) __PYX_ERR(0, 2201, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__291);
__Pyx_GIVEREF(__pyx_tuple__291);
__pyx_codeobj__292 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__291, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_pulsed_env, 2201, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__292)) __PYX_ERR(0, 2201, __pyx_L1_error)
/* … */
__pyx_t_43 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_169pulsed_env, 0, __pyx_n_s_pulsed_env, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__292)); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 2201, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
__Pyx_CyFunction_SetDefaultsTuple(__pyx_t_43, __pyx_tuple__293);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_pulsed_env, __pyx_t_43) < 0) __PYX_ERR(0, 2201, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
__pyx_tuple__293 = PyTuple_Pack(1, __pyx_float_0_0); if (unlikely(!__pyx_tuple__293)) __PYX_ERR(0, 2201, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__293);
__Pyx_GIVEREF(__pyx_tuple__293);
2202: """
2203: next sample from envelope generator.
2204:
2205: :param gen: env gen
2206: :param fm: change frequency of repetition
2207: :rtype: float
2208: """
+2209: return cclm.mus_pulsed_env(gen._ptr, fm)
__pyx_r = mus_pulsed_env(__pyx_v_gen->_ptr, __pyx_v_fm); goto __pyx_L0;
2210:
+2211: cpdef cython.double pulsed_env_unmodulated(mus_any gen):
static PyObject *__pyx_pw_8pysndlib_3clm_171pulsed_env_unmodulated(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static double __pyx_f_8pysndlib_3clm_pulsed_env_unmodulated(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, CYTHON_UNUSED int __pyx_skip_dispatch) {
double __pyx_r;
/* … */
/* function exit code */
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_171pulsed_env_unmodulated(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_170pulsed_env_unmodulated, "\n next sample from envelope generator. no modulations\n \n :param gen: env gen\n :rtype: float\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_171pulsed_env_unmodulated = {"pulsed_env_unmodulated", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_171pulsed_env_unmodulated, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_170pulsed_env_unmodulated};
static PyObject *__pyx_pw_8pysndlib_3clm_171pulsed_env_unmodulated(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("pulsed_env_unmodulated (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gen,0};
PyObject* values[1] = {0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_gen)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2211, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "pulsed_env_unmodulated") < 0)) __PYX_ERR(0, 2211, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 1)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
}
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)values[0]);
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("pulsed_env_unmodulated", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 2211, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.pulsed_env_unmodulated", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gen), __pyx_ptype_8pysndlib_3clm_mus_any, 1, "gen", 0))) __PYX_ERR(0, 2211, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_170pulsed_env_unmodulated(__pyx_self, __pyx_v_gen);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_170pulsed_env_unmodulated(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8pysndlib_3clm_pulsed_env_unmodulated(__pyx_v_gen, 0); if (unlikely(__pyx_t_1 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2211, __pyx_L1_error)
__pyx_t_2 = PyFloat_FromDouble(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2211, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("pysndlib.clm.pulsed_env_unmodulated", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_43 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_171pulsed_env_unmodulated, 0, __pyx_n_s_pulsed_env_unmodulated, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__294)); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 2211, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_pulsed_env_unmodulated, __pyx_t_43) < 0) __PYX_ERR(0, 2211, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
/* … */
__pyx_codeobj__294 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__56, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_pulsed_env_unmodulated, 2211, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__294)) __PYX_ERR(0, 2211, __pyx_L1_error)
2212: """
2213: next sample from envelope generator. no modulations
2214:
2215: :param gen: env gen
2216: :rtype: float
2217: """
+2218: return cclm.mus_pulsed_env_unmodulated(gen._ptr)
__pyx_r = mus_pulsed_env_unmodulated(__pyx_v_gen->_ptr); goto __pyx_L0;
2219:
+2220: cpdef bint is_pulsed_env(mus_any gen):
static PyObject *__pyx_pw_8pysndlib_3clm_173is_pulsed_env(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static int __pyx_f_8pysndlib_3clm_is_pulsed_env(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, CYTHON_UNUSED int __pyx_skip_dispatch) {
int __pyx_r;
/* … */
/* function exit code */
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_173is_pulsed_env(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_172is_pulsed_env, "\n returns True if gen is a pulsed_env.\n \n :param gen: gen\n :rtype: bool\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_173is_pulsed_env = {"is_pulsed_env", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_173is_pulsed_env, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_172is_pulsed_env};
static PyObject *__pyx_pw_8pysndlib_3clm_173is_pulsed_env(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("is_pulsed_env (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gen,0};
PyObject* values[1] = {0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_gen)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2220, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "is_pulsed_env") < 0)) __PYX_ERR(0, 2220, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 1)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
}
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)values[0]);
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("is_pulsed_env", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 2220, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.is_pulsed_env", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gen), __pyx_ptype_8pysndlib_3clm_mus_any, 1, "gen", 0))) __PYX_ERR(0, 2220, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_172is_pulsed_env(__pyx_self, __pyx_v_gen);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_172is_pulsed_env(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8pysndlib_3clm_is_pulsed_env(__pyx_v_gen, 0); if (unlikely(__pyx_t_1 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2220, __pyx_L1_error)
__pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2220, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("pysndlib.clm.is_pulsed_env", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_43 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_173is_pulsed_env, 0, __pyx_n_s_is_pulsed_env, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__295)); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 2220, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_is_pulsed_env, __pyx_t_43) < 0) __PYX_ERR(0, 2220, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
/* … */
__pyx_codeobj__295 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__56, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_is_pulsed_env, 2220, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__295)) __PYX_ERR(0, 2220, __pyx_L1_error)
2221: """
2222: returns True if gen is a pulsed_env.
2223:
2224: :param gen: gen
2225: :rtype: bool
2226: """
+2227: return cclm.mus_is_pulsed_env(gen._ptr)
__pyx_r = mus_is_pulsed_env(__pyx_v_gen->_ptr); goto __pyx_L0;
2228:
2229: # todo envelope-interp different than env-interp
2230:
2231: # ---------------- table-lookup ---------------- #
+2232: cpdef mus_any make_table_lookup(cython.double frequency=0.0, cython.double initial_phase=0.0, wave= None, cython.int size=CLM.table_size, Interp interp_type=Interp.LINEAR):
static PyObject *__pyx_pw_8pysndlib_3clm_175make_table_lookup(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_f_8pysndlib_3clm_make_table_lookup(CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_8pysndlib_3clm_make_table_lookup *__pyx_optional_args) {
double __pyx_v_frequency = ((double)0.0);
double __pyx_v_initial_phase = ((double)0.0);
PyObject *__pyx_v_wave = ((PyObject *)Py_None);
int __pyx_v_size = __pyx_k__32;
enum __pyx_t_8pysndlib_3clm_Interp __pyx_v_interp_type = __pyx_k__33;
__Pyx_memviewslice __pyx_v_wave_view = { 0, 0, { 0 }, { 0 }, { 0 } };
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = NULL;
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_r = NULL;
if (__pyx_optional_args) {
if (__pyx_optional_args->__pyx_n > 0) {
__pyx_v_frequency = __pyx_optional_args->frequency;
if (__pyx_optional_args->__pyx_n > 1) {
__pyx_v_initial_phase = __pyx_optional_args->initial_phase;
if (__pyx_optional_args->__pyx_n > 2) {
__pyx_v_wave = __pyx_optional_args->wave;
if (__pyx_optional_args->__pyx_n > 3) {
__pyx_v_size = __pyx_optional_args->size;
if (__pyx_optional_args->__pyx_n > 4) {
__pyx_v_interp_type = __pyx_optional_args->interp_type;
}
}
}
}
}
}
__Pyx_INCREF(__pyx_v_wave);
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_XDECREF(__pyx_t_7);
__Pyx_XDECREF(__pyx_t_9);
__PYX_XCLEAR_MEMVIEW(&__pyx_t_10, 1);
__Pyx_AddTraceback("pysndlib.clm.make_table_lookup", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__PYX_XCLEAR_MEMVIEW(&__pyx_v_wave_view, 1);
__Pyx_XDECREF((PyObject *)__pyx_v_gen);
__Pyx_XDECREF(__pyx_v_wave);
__Pyx_XGIVEREF((PyObject *)__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_175make_table_lookup(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_174make_table_lookup, "\n return a new table_lookup generator. the default table size is 512; use size to set some other\n size, or pass your own list/array as the 'wave'.\n \n :param frequency: frequency of gen \\in hz\n :param initial_phase: initial phase of gen \\in radians\n :param wave: np.ndarray if provided is waveform\n :param size: if no wave provided, this will allocate a table of size \n :param interp_type: type of interpolation used\n :return: table_lookup gen\n :rtype: mus_any\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_175make_table_lookup = {"make_table_lookup", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_175make_table_lookup, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_174make_table_lookup};
static PyObject *__pyx_pw_8pysndlib_3clm_175make_table_lookup(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
double __pyx_v_frequency;
double __pyx_v_initial_phase;
PyObject *__pyx_v_wave = 0;
int __pyx_v_size;
enum __pyx_t_8pysndlib_3clm_Interp __pyx_v_interp_type;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("make_table_lookup (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_frequency,&__pyx_n_s_initial_phase,&__pyx_n_s_wave,&__pyx_n_s_size,&__pyx_n_s_interp_type,0};
PyObject* values[5] = {0,0,0,0,0};
values[2] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4);
CYTHON_FALLTHROUGH;
case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
CYTHON_FALLTHROUGH;
case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_frequency);
if (value) { values[0] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2232, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 1:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_initial_phase);
if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2232, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 2:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_wave);
if (value) { values[2] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2232, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 3:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_size);
if (value) { values[3] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2232, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 4:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_interp_type);
if (value) { values[4] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2232, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "make_table_lookup") < 0)) __PYX_ERR(0, 2232, __pyx_L3_error)
}
} else {
switch (__pyx_nargs) {
case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4);
CYTHON_FALLTHROUGH;
case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
CYTHON_FALLTHROUGH;
case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
}
if (values[0]) {
__pyx_v_frequency = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_frequency == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2232, __pyx_L3_error)
} else {
__pyx_v_frequency = ((double)0.0);
}
if (values[1]) {
__pyx_v_initial_phase = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_initial_phase == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2232, __pyx_L3_error)
} else {
__pyx_v_initial_phase = ((double)0.0);
}
__pyx_v_wave = values[2];
if (values[3]) {
__pyx_v_size = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_size == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2232, __pyx_L3_error)
} else {
__pyx_v_size = __pyx_k__32;
}
if (values[4]) {
__pyx_v_interp_type = ((enum __pyx_t_8pysndlib_3clm_Interp)__Pyx_PyInt_As_enum____pyx_t_8pysndlib_3clm_Interp(values[4])); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2232, __pyx_L3_error)
} else {
__pyx_v_interp_type = __pyx_k__33;
}
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("make_table_lookup", 0, 0, 5, __pyx_nargs); __PYX_ERR(0, 2232, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.make_table_lookup", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_8pysndlib_3clm_174make_table_lookup(__pyx_self, __pyx_v_frequency, __pyx_v_initial_phase, __pyx_v_wave, __pyx_v_size, __pyx_v_interp_type);
/* function exit code */
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_174make_table_lookup(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_frequency, double __pyx_v_initial_phase, PyObject *__pyx_v_wave, int __pyx_v_size, enum __pyx_t_8pysndlib_3clm_Interp __pyx_v_interp_type) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_2.__pyx_n = 5;
__pyx_t_2.frequency = __pyx_v_frequency;
__pyx_t_2.initial_phase = __pyx_v_initial_phase;
__pyx_t_2.wave = __pyx_v_wave;
__pyx_t_2.size = __pyx_v_size;
__pyx_t_2.interp_type = __pyx_v_interp_type;
__pyx_t_1 = ((PyObject *)__pyx_f_8pysndlib_3clm_make_table_lookup(0, &__pyx_t_2)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2232, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("pysndlib.clm.make_table_lookup", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__Pyx_GetModuleGlobalName(__pyx_t_43, __pyx_n_s_CLM); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 2232, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
__pyx_t_40 = __Pyx_PyObject_GetAttrStr(__pyx_t_43, __pyx_n_s_table_size); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 2232, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
__pyx_t_44 = __Pyx_PyInt_As_int(__pyx_t_40); if (unlikely((__pyx_t_44 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2232, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
__pyx_k__32 = __pyx_t_44;
__pyx_k__33 = __pyx_e_8pysndlib_3clm_LINEAR;
/* … */
__pyx_tuple__296 = PyTuple_Pack(5, __pyx_n_s_frequency, __pyx_n_s_initial_phase, __pyx_n_s_wave, __pyx_n_s_size, __pyx_n_s_interp_type); if (unlikely(!__pyx_tuple__296)) __PYX_ERR(0, 2232, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__296);
__Pyx_GIVEREF(__pyx_tuple__296);
__Pyx_GetModuleGlobalName(__pyx_t_40, __pyx_n_s_CLM); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 2232, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
__pyx_t_43 = __Pyx_PyObject_GetAttrStr(__pyx_t_40, __pyx_n_s_table_size); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 2232, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
__pyx_t_44 = __Pyx_PyInt_As_int(__pyx_t_43); if (unlikely((__pyx_t_44 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2232, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
__pyx_t_43 = __Pyx_PyInt_From_int(__pyx_t_44); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 2232, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
__pyx_t_40 = __Pyx_Enum_Interp_to_py(__pyx_e_8pysndlib_3clm_LINEAR); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 2232, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
__pyx_t_37 = PyTuple_New(5); if (unlikely(!__pyx_t_37)) __PYX_ERR(0, 2232, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_37);
__Pyx_INCREF(__pyx_float_0_0);
__Pyx_GIVEREF(__pyx_float_0_0);
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_37, 0, __pyx_float_0_0)) __PYX_ERR(0, 2232, __pyx_L1_error);
__Pyx_INCREF(__pyx_float_0_0);
__Pyx_GIVEREF(__pyx_float_0_0);
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_37, 1, __pyx_float_0_0)) __PYX_ERR(0, 2232, __pyx_L1_error);
__Pyx_INCREF(Py_None);
__Pyx_GIVEREF(Py_None);
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_37, 2, Py_None)) __PYX_ERR(0, 2232, __pyx_L1_error);
__Pyx_GIVEREF(__pyx_t_43);
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_37, 3, __pyx_t_43)) __PYX_ERR(0, 2232, __pyx_L1_error);
__Pyx_GIVEREF(__pyx_t_40);
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_37, 4, __pyx_t_40)) __PYX_ERR(0, 2232, __pyx_L1_error);
__pyx_t_43 = 0;
__pyx_t_40 = 0;
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_175make_table_lookup, 0, __pyx_n_s_make_table_lookup, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__297)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 2232, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
__Pyx_CyFunction_SetDefaultsTuple(__pyx_t_40, __pyx_t_37);
__Pyx_DECREF(__pyx_t_37); __pyx_t_37 = 0;
if (PyDict_SetItem(__pyx_d, __pyx_n_s_make_table_lookup, __pyx_t_40) < 0) __PYX_ERR(0, 2232, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
__pyx_codeobj__297 = (PyObject*)__Pyx_PyCode_New(5, 0, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__296, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_make_table_lookup, 2232, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__297)) __PYX_ERR(0, 2232, __pyx_L1_error)
/* … */
struct __pyx_opt_args_8pysndlib_3clm_make_table_lookup {
int __pyx_n;
double frequency;
double initial_phase;
PyObject *wave;
int size;
enum __pyx_t_8pysndlib_3clm_Interp interp_type;
};
2233: """
2234: return a new table_lookup generator. the default table size is 512; use size to set some other
2235: size, or pass your own list/array as the 'wave'.
2236:
2237: :param frequency: frequency of gen \in hz
2238: :param initial_phase: initial phase of gen \in radians
2239: :param wave: np.ndarray if provided is waveform
2240: :param size: if no wave provided, this will allocate a table of size
2241: :param interp_type: type of interpolation used
2242: :return: table_lookup gen
2243: :rtype: mus_any
2244: """
2245:
+2246: check_range('frequency', frequency, 0.0, get_srate() / 2)
__pyx_t_1 = PyFloat_FromDouble(__pyx_v_frequency); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2246, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __pyx_f_8pysndlib_3clm_get_srate(0); if (unlikely(__pyx_t_2 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2246, __pyx_L1_error) __pyx_t_3 = PyFloat_FromDouble((__pyx_t_2 / 2.0)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2246, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_5.__pyx_n = 2; __pyx_t_5.low = __pyx_float_0_0; __pyx_t_5.high = __pyx_t_3; __pyx_t_4 = __pyx_f_8pysndlib_3clm_check_range(__pyx_n_s_frequency, __pyx_t_1, 0, &__pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2246, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
2247:
+2248: if wave is None:
__pyx_t_6 = (__pyx_v_wave == Py_None);
if (__pyx_t_6) {
/* … */
}
+2249: wave = np.zeros(size)
__Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2249, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2249, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_size); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2249, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_7 = NULL; __pyx_t_8 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_1))) { __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_1); if (likely(__pyx_t_7)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); __Pyx_INCREF(__pyx_t_7); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_1, function); __pyx_t_8 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_t_3}; __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_1, __pyx_callargs+1-__pyx_t_8, 1+__pyx_t_8); __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2249, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } __Pyx_DECREF_SET(__pyx_v_wave, __pyx_t_4); __pyx_t_4 = 0;
2250:
+2251: if isinstance(wave, list):
__pyx_t_6 = PyList_Check(__pyx_v_wave);
if (__pyx_t_6) {
/* … */
}
+2252: wave = np.array(wave, dtype=np.double)
__Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2252, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_array); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2252, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2252, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_INCREF(__pyx_v_wave); __Pyx_GIVEREF(__pyx_v_wave); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_wave)) __PYX_ERR(0, 2252, __pyx_L1_error); __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2252, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2252, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_double); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2252, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_dtype, __pyx_t_9) < 0) __PYX_ERR(0, 2252, __pyx_L1_error) __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2252, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF_SET(__pyx_v_wave, __pyx_t_9); __pyx_t_9 = 0;
2253:
+2254: check_ndim(wave)
__pyx_t_9 = __pyx_f_8pysndlib_3clm_check_ndim(__pyx_v_wave, 0, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2254, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
2255:
+2256: cdef double [:] wave_view = wave
__pyx_t_10 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_v_wave, PyBUF_WRITABLE); if (unlikely(!__pyx_t_10.memview)) __PYX_ERR(0, 2256, __pyx_L1_error) __pyx_v_wave_view = __pyx_t_10; __pyx_t_10.memview = NULL; __pyx_t_10.data = NULL;
2257:
2258:
2259: #print(frequency, initial_phase, wave, size, interp_type)
+2260: gen = mus_any.from_ptr(cclm.mus_make_table_lookup(frequency, initial_phase, &wave_view[0], size, <cclm.mus_interp_t>interp_type))
__pyx_t_11 = 0;
__pyx_t_8 = -1;
if (__pyx_t_11 < 0) {
__pyx_t_11 += __pyx_v_wave_view.shape[0];
if (unlikely(__pyx_t_11 < 0)) __pyx_t_8 = 0;
} else if (unlikely(__pyx_t_11 >= __pyx_v_wave_view.shape[0])) __pyx_t_8 = 0;
if (unlikely(__pyx_t_8 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_8);
__PYX_ERR(0, 2260, __pyx_L1_error)
}
__pyx_t_9 = ((PyObject *)__pyx_vtabptr_8pysndlib_3clm_mus_any->from_ptr(mus_make_table_lookup(__pyx_v_frequency, __pyx_v_initial_phase, (&(*((double *) ( /* dim=0 */ (__pyx_v_wave_view.data + __pyx_t_11 * __pyx_v_wave_view.strides[0]) )))), __pyx_v_size, ((mus_interp_t)__pyx_v_interp_type)), NULL)); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2260, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_9);
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_t_9);
__pyx_t_9 = 0;
+2261: gen.cache_append(wave)
__pyx_t_9 = ((struct __pyx_vtabstruct_8pysndlib_3clm_mus_any *)__pyx_v_gen->__pyx_vtab)->cache_append(__pyx_v_gen, __pyx_v_wave, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2261, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+2262: return gen
__Pyx_XDECREF((PyObject *)__pyx_r); __Pyx_INCREF((PyObject *)__pyx_v_gen); __pyx_r = __pyx_v_gen; goto __pyx_L0;
2263:
+2264: cpdef cython.double table_lookup(mus_any gen, cython.double fm =0.0):
static PyObject *__pyx_pw_8pysndlib_3clm_177table_lookup(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static double __pyx_f_8pysndlib_3clm_table_lookup(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_8pysndlib_3clm_table_lookup *__pyx_optional_args) {
double __pyx_v_fm = ((double)0.0);
double __pyx_r;
if (__pyx_optional_args) {
if (__pyx_optional_args->__pyx_n > 0) {
__pyx_v_fm = __pyx_optional_args->fm;
}
}
/* … */
/* function exit code */
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_177table_lookup(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_176table_lookup, "\n return next sample from table_lookup generator.\n \n :param gen: table_lookup gen\n :param fm: fm input\n :rtype: float\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_177table_lookup = {"table_lookup", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_177table_lookup, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_176table_lookup};
static PyObject *__pyx_pw_8pysndlib_3clm_177table_lookup(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = 0;
double __pyx_v_fm;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("table_lookup (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gen,&__pyx_n_s_fm,0};
PyObject* values[2] = {0,0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_gen)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2264, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_fm);
if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2264, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "table_lookup") < 0)) __PYX_ERR(0, 2264, __pyx_L3_error)
}
} else {
switch (__pyx_nargs) {
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
break;
default: goto __pyx_L5_argtuple_error;
}
}
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)values[0]);
if (values[1]) {
__pyx_v_fm = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_fm == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2264, __pyx_L3_error)
} else {
__pyx_v_fm = ((double)0.0);
}
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("table_lookup", 0, 1, 2, __pyx_nargs); __PYX_ERR(0, 2264, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.table_lookup", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gen), __pyx_ptype_8pysndlib_3clm_mus_any, 1, "gen", 0))) __PYX_ERR(0, 2264, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_176table_lookup(__pyx_self, __pyx_v_gen, __pyx_v_fm);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_176table_lookup(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, double __pyx_v_fm) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_2.__pyx_n = 1;
__pyx_t_2.fm = __pyx_v_fm;
__pyx_t_1 = __pyx_f_8pysndlib_3clm_table_lookup(__pyx_v_gen, 0, &__pyx_t_2); if (unlikely(__pyx_t_1 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2264, __pyx_L1_error)
__pyx_t_3 = PyFloat_FromDouble(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2264, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__pyx_r = __pyx_t_3;
__pyx_t_3 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_3);
__Pyx_AddTraceback("pysndlib.clm.table_lookup", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_codeobj__298 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__291, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_table_lookup, 2264, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__298)) __PYX_ERR(0, 2264, __pyx_L1_error)
/* … */
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_177table_lookup, 0, __pyx_n_s_table_lookup, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__298)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 2264, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
__Pyx_CyFunction_SetDefaultsTuple(__pyx_t_40, __pyx_tuple__299);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_table_lookup, __pyx_t_40) < 0) __PYX_ERR(0, 2264, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
__pyx_tuple__299 = PyTuple_Pack(1, __pyx_float_0_0); if (unlikely(!__pyx_tuple__299)) __PYX_ERR(0, 2264, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__299);
__Pyx_GIVEREF(__pyx_tuple__299);
2265: """
2266: return next sample from table_lookup generator.
2267:
2268: :param gen: table_lookup gen
2269: :param fm: fm input
2270: :rtype: float
2271: """
+2272: return cclm.mus_table_lookup(gen._ptr, fm)
__pyx_r = mus_table_lookup(__pyx_v_gen->_ptr, __pyx_v_fm); goto __pyx_L0;
2273:
+2274: cpdef cython.double table_lookup_unmodulated(mus_any gen):
static PyObject *__pyx_pw_8pysndlib_3clm_179table_lookup_unmodulated(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static double __pyx_f_8pysndlib_3clm_table_lookup_unmodulated(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, CYTHON_UNUSED int __pyx_skip_dispatch) {
double __pyx_r;
/* … */
/* function exit code */
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_179table_lookup_unmodulated(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_178table_lookup_unmodulated, "\n return next sample from table_lookup generator. unmodulated\n \n :param gen: table_lookup gen\n :rtype: float\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_179table_lookup_unmodulated = {"table_lookup_unmodulated", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_179table_lookup_unmodulated, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_178table_lookup_unmodulated};
static PyObject *__pyx_pw_8pysndlib_3clm_179table_lookup_unmodulated(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("table_lookup_unmodulated (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gen,0};
PyObject* values[1] = {0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_gen)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2274, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "table_lookup_unmodulated") < 0)) __PYX_ERR(0, 2274, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 1)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
}
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)values[0]);
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("table_lookup_unmodulated", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 2274, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.table_lookup_unmodulated", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gen), __pyx_ptype_8pysndlib_3clm_mus_any, 1, "gen", 0))) __PYX_ERR(0, 2274, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_178table_lookup_unmodulated(__pyx_self, __pyx_v_gen);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_178table_lookup_unmodulated(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8pysndlib_3clm_table_lookup_unmodulated(__pyx_v_gen, 0); if (unlikely(__pyx_t_1 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2274, __pyx_L1_error)
__pyx_t_2 = PyFloat_FromDouble(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2274, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("pysndlib.clm.table_lookup_unmodulated", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_179table_lookup_unmodulated, 0, __pyx_n_s_table_lookup_unmodulated, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__300)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 2274, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_table_lookup_unmodulated, __pyx_t_40) < 0) __PYX_ERR(0, 2274, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
/* … */
__pyx_codeobj__300 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__56, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_table_lookup_unmodulated, 2274, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__300)) __PYX_ERR(0, 2274, __pyx_L1_error)
2275: """
2276: return next sample from table_lookup generator. unmodulated
2277:
2278: :param gen: table_lookup gen
2279: :rtype: float
2280: """
+2281: return cclm.mus_table_lookup_unmodulated(gen._ptr)
__pyx_r = mus_table_lookup_unmodulated(__pyx_v_gen->_ptr); goto __pyx_L0;
2282:
+2283: cpdef bint is_table_lookup(mus_any gen):
static PyObject *__pyx_pw_8pysndlib_3clm_181is_table_lookup(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static int __pyx_f_8pysndlib_3clm_is_table_lookup(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, CYTHON_UNUSED int __pyx_skip_dispatch) {
int __pyx_r;
/* … */
/* function exit code */
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_181is_table_lookup(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_180is_table_lookup, "\n returns True if gen is a table_lookup.\n \n :param gen: gen\n :rtype: bool\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_181is_table_lookup = {"is_table_lookup", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_181is_table_lookup, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_180is_table_lookup};
static PyObject *__pyx_pw_8pysndlib_3clm_181is_table_lookup(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("is_table_lookup (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gen,0};
PyObject* values[1] = {0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_gen)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2283, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "is_table_lookup") < 0)) __PYX_ERR(0, 2283, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 1)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
}
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)values[0]);
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("is_table_lookup", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 2283, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.is_table_lookup", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gen), __pyx_ptype_8pysndlib_3clm_mus_any, 1, "gen", 0))) __PYX_ERR(0, 2283, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_180is_table_lookup(__pyx_self, __pyx_v_gen);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_180is_table_lookup(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8pysndlib_3clm_is_table_lookup(__pyx_v_gen, 0); if (unlikely(__pyx_t_1 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2283, __pyx_L1_error)
__pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2283, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("pysndlib.clm.is_table_lookup", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_181is_table_lookup, 0, __pyx_n_s_is_table_lookup, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__301)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 2283, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_is_table_lookup, __pyx_t_40) < 0) __PYX_ERR(0, 2283, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
/* … */
__pyx_codeobj__301 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__56, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_is_table_lookup, 2283, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__301)) __PYX_ERR(0, 2283, __pyx_L1_error)
2284: """
2285: returns True if gen is a table_lookup.
2286:
2287: :param gen: gen
2288: :rtype: bool
2289: """
+2290: return cclm.mus_is_table_lookup(gen._ptr)
__pyx_r = mus_is_table_lookup(__pyx_v_gen->_ptr); goto __pyx_L0;
2291:
2292:
+2293: cpdef mus_any make_table_lookup_with_env(cython.double frequency, envelope, size= None):
static PyObject *__pyx_pw_8pysndlib_3clm_183make_table_lookup_with_env(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_f_8pysndlib_3clm_make_table_lookup_with_env(double __pyx_v_frequency, PyObject *__pyx_v_envelope, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_8pysndlib_3clm_make_table_lookup_with_env *__pyx_optional_args) {
PyObject *__pyx_v_size = ((PyObject *)Py_None);
PyObject *__pyx_v_table = NULL;
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_e = NULL;
PyObject *__pyx_v_i = NULL;
__Pyx_memviewslice __pyx_v_table_view = { 0, 0, { 0 }, { 0 }, { 0 } };
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = NULL;
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_r = NULL;
if (__pyx_optional_args) {
if (__pyx_optional_args->__pyx_n > 0) {
__pyx_v_size = __pyx_optional_args->size;
}
}
__Pyx_INCREF(__pyx_v_size);
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_XDECREF(__pyx_t_8);
__PYX_XCLEAR_MEMVIEW(&__pyx_t_11, 1);
__Pyx_AddTraceback("pysndlib.clm.make_table_lookup_with_env", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XDECREF(__pyx_v_table);
__Pyx_XDECREF((PyObject *)__pyx_v_e);
__Pyx_XDECREF(__pyx_v_i);
__PYX_XCLEAR_MEMVIEW(&__pyx_v_table_view, 1);
__Pyx_XDECREF((PyObject *)__pyx_v_gen);
__Pyx_XDECREF(__pyx_v_size);
__Pyx_XGIVEREF((PyObject *)__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_183make_table_lookup_with_env(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_182make_table_lookup_with_env, "\n return a new table_lookup generator with the envelope loaded \\in with size.\n \n :param frequency: frequency of gen \\in hz\n :param env: envelope shape to load into generator\n :param size: size of table derived from envelope\n :return: table_lookup gen\n :rtype: mus_any\n \n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_183make_table_lookup_with_env = {"make_table_lookup_with_env", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_183make_table_lookup_with_env, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_182make_table_lookup_with_env};
static PyObject *__pyx_pw_8pysndlib_3clm_183make_table_lookup_with_env(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
double __pyx_v_frequency;
PyObject *__pyx_v_envelope = 0;
PyObject *__pyx_v_size = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("make_table_lookup_with_env (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_frequency,&__pyx_n_s_envelope,&__pyx_n_s_size,0};
PyObject* values[3] = {0,0,0};
values[2] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_frequency)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2293, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_envelope)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2293, __pyx_L3_error)
else {
__Pyx_RaiseArgtupleInvalid("make_table_lookup_with_env", 0, 2, 3, 1); __PYX_ERR(0, 2293, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 2:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_size);
if (value) { values[2] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2293, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "make_table_lookup_with_env") < 0)) __PYX_ERR(0, 2293, __pyx_L3_error)
}
} else {
switch (__pyx_nargs) {
case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
break;
default: goto __pyx_L5_argtuple_error;
}
}
__pyx_v_frequency = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_frequency == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2293, __pyx_L3_error)
__pyx_v_envelope = values[1];
__pyx_v_size = values[2];
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("make_table_lookup_with_env", 0, 2, 3, __pyx_nargs); __PYX_ERR(0, 2293, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.make_table_lookup_with_env", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_8pysndlib_3clm_182make_table_lookup_with_env(__pyx_self, __pyx_v_frequency, __pyx_v_envelope, __pyx_v_size);
/* function exit code */
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_182make_table_lookup_with_env(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_frequency, PyObject *__pyx_v_envelope, PyObject *__pyx_v_size) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_2.__pyx_n = 1;
__pyx_t_2.size = __pyx_v_size;
__pyx_t_1 = ((PyObject *)__pyx_f_8pysndlib_3clm_make_table_lookup_with_env(__pyx_v_frequency, __pyx_v_envelope, 0, &__pyx_t_2)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2293, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("pysndlib.clm.make_table_lookup_with_env", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_tuple__302 = PyTuple_Pack(3, __pyx_n_s_frequency, __pyx_n_s_envelope, __pyx_n_s_size); if (unlikely(!__pyx_tuple__302)) __PYX_ERR(0, 2293, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__302);
__Pyx_GIVEREF(__pyx_tuple__302);
/* … */
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_183make_table_lookup_with_env, 0, __pyx_n_s_make_table_lookup_with_env, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__303)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 2293, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
__Pyx_CyFunction_SetDefaultsTuple(__pyx_t_40, __pyx_tuple__90);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_make_table_lookup_with_env, __pyx_t_40) < 0) __PYX_ERR(0, 2293, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
__pyx_codeobj__303 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__302, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_make_table_lookup_with_env, 2293, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__303)) __PYX_ERR(0, 2293, __pyx_L1_error)
/* … */
struct __pyx_opt_args_8pysndlib_3clm_make_table_lookup_with_env {
int __pyx_n;
PyObject *size;
};
2294: """
2295: return a new table_lookup generator with the envelope loaded \in with size.
2296:
2297: :param frequency: frequency of gen \in hz
2298: :param env: envelope shape to load into generator
2299: :param size: size of table derived from envelope
2300: :return: table_lookup gen
2301: :rtype: mus_any
2302:
2303: """
2304:
+2305: check_range('frequency', frequency, 0.0, get_srate() / 2)
__pyx_t_1 = PyFloat_FromDouble(__pyx_v_frequency); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2305, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __pyx_f_8pysndlib_3clm_get_srate(0); if (unlikely(__pyx_t_2 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2305, __pyx_L1_error) __pyx_t_3 = PyFloat_FromDouble((__pyx_t_2 / 2.0)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2305, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_5.__pyx_n = 2; __pyx_t_5.low = __pyx_float_0_0; __pyx_t_5.high = __pyx_t_3; __pyx_t_4 = __pyx_f_8pysndlib_3clm_check_range(__pyx_n_s_frequency, __pyx_t_1, 0, &__pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2305, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
2306:
+2307: size = size or CLM.table_size
__pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_size); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 2307, __pyx_L1_error) if (!__pyx_t_6) { } else { __Pyx_INCREF(__pyx_v_size); __pyx_t_4 = __pyx_v_size; goto __pyx_L3_bool_binop_done; } __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_CLM); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2307, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_table_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2307, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_INCREF(__pyx_t_1); __pyx_t_4 = __pyx_t_1; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_L3_bool_binop_done:; __Pyx_DECREF_SET(__pyx_v_size, __pyx_t_4); __pyx_t_4 = 0;
+2308: table = np.zeros(size)
__Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2308, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2308, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = NULL; __pyx_t_7 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_3))) { __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_1)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_1); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); __pyx_t_7 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_v_size}; __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7); __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2308, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } __pyx_v_table = __pyx_t_4; __pyx_t_4 = 0;
+2309: e = make_env(envelope, length=size)
__Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_make_env); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2309, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2309, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_v_envelope); __Pyx_GIVEREF(__pyx_v_envelope); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_envelope)) __PYX_ERR(0, 2309, __pyx_L1_error); __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2309, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_length, __pyx_v_size) < 0) __PYX_ERR(0, 2309, __pyx_L1_error) __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2309, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (!(likely(((__pyx_t_8) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_8, __pyx_ptype_8pysndlib_3clm_mus_any))))) __PYX_ERR(0, 2309, __pyx_L1_error) __pyx_v_e = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_t_8); __pyx_t_8 = 0;
+2310: for i in range(size):
__pyx_t_8 = __Pyx_PyObject_CallOneArg(__pyx_builtin_range, __pyx_v_size); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2310, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); if (likely(PyList_CheckExact(__pyx_t_8)) || PyTuple_CheckExact(__pyx_t_8)) { __pyx_t_1 = __pyx_t_8; __Pyx_INCREF(__pyx_t_1); __pyx_t_9 = 0; __pyx_t_10 = NULL; } else { __pyx_t_9 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2310, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_10 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2310, __pyx_L1_error) } __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; for (;;) { if (likely(!__pyx_t_10)) { if (likely(PyList_CheckExact(__pyx_t_1))) { { Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1); #if !CYTHON_ASSUME_SAFE_MACROS if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 2310, __pyx_L1_error) #endif if (__pyx_t_9 >= __pyx_temp) break; } #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS __pyx_t_8 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_9); __Pyx_INCREF(__pyx_t_8); __pyx_t_9++; if (unlikely((0 < 0))) __PYX_ERR(0, 2310, __pyx_L1_error) #else __pyx_t_8 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2310, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); #endif } else { { Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1); #if !CYTHON_ASSUME_SAFE_MACROS if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 2310, __pyx_L1_error) #endif if (__pyx_t_9 >= __pyx_temp) break; } #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS __pyx_t_8 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_9); __Pyx_INCREF(__pyx_t_8); __pyx_t_9++; if (unlikely((0 < 0))) __PYX_ERR(0, 2310, __pyx_L1_error) #else __pyx_t_8 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2310, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); #endif } } else { __pyx_t_8 = __pyx_t_10(__pyx_t_1); if (unlikely(!__pyx_t_8)) { PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); else __PYX_ERR(0, 2310, __pyx_L1_error) } break; } __Pyx_GOTREF(__pyx_t_8); } __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_8); __pyx_t_8 = 0; /* … */ } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+2311: table[i] = env(e)
__pyx_t_2 = __pyx_f_8pysndlib_3clm_env(__pyx_v_e, 0); if (unlikely(__pyx_t_2 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2311, __pyx_L1_error) __pyx_t_8 = PyFloat_FromDouble(__pyx_t_2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2311, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); if (unlikely((PyObject_SetItem(__pyx_v_table, __pyx_v_i, __pyx_t_8) < 0))) __PYX_ERR(0, 2311, __pyx_L1_error) __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+2312: cdef double [:] table_view = table
__pyx_t_11 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_v_table, PyBUF_WRITABLE); if (unlikely(!__pyx_t_11.memview)) __PYX_ERR(0, 2312, __pyx_L1_error) __pyx_v_table_view = __pyx_t_11; __pyx_t_11.memview = NULL; __pyx_t_11.data = NULL;
2313:
+2314: gen = mus_any.from_ptr(cclm.mus_make_table_lookup(frequency, 0, &table_view[0], size, <cclm.mus_interp_t>Interp.LINEAR))
__pyx_t_12 = 0;
__pyx_t_7 = -1;
if (__pyx_t_12 < 0) {
__pyx_t_12 += __pyx_v_table_view.shape[0];
if (unlikely(__pyx_t_12 < 0)) __pyx_t_7 = 0;
} else if (unlikely(__pyx_t_12 >= __pyx_v_table_view.shape[0])) __pyx_t_7 = 0;
if (unlikely(__pyx_t_7 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_7);
__PYX_ERR(0, 2314, __pyx_L1_error)
}
__pyx_t_13 = __Pyx_PyInt_As_int64_t(__pyx_v_size); if (unlikely((__pyx_t_13 == ((mus_long_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 2314, __pyx_L1_error)
__pyx_t_1 = ((PyObject *)__pyx_vtabptr_8pysndlib_3clm_mus_any->from_ptr(mus_make_table_lookup(__pyx_v_frequency, 0.0, (&(*((double *) ( /* dim=0 */ (__pyx_v_table_view.data + __pyx_t_12 * __pyx_v_table_view.strides[0]) )))), __pyx_t_13, ((mus_interp_t)__pyx_e_8pysndlib_3clm_LINEAR)), NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2314, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_t_1);
__pyx_t_1 = 0;
+2315: gen.cache_append(table)
__pyx_t_1 = ((struct __pyx_vtabstruct_8pysndlib_3clm_mus_any *)__pyx_v_gen->__pyx_vtab)->cache_append(__pyx_v_gen, __pyx_v_table, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2315, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+2316: return gen
__Pyx_XDECREF((PyObject *)__pyx_r); __Pyx_INCREF((PyObject *)__pyx_v_gen); __pyx_r = __pyx_v_gen; goto __pyx_L0;
2317:
2318: # ---------------- polywave ---------------- #
+2319: cpdef mus_any make_polywave(cython.double frequency, partials = [0.,1.], Polynomial kind=Polynomial.FIRST_KIND, xcoeffs=None, ycoeffs=None):
static PyObject *__pyx_pw_8pysndlib_3clm_185make_polywave(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_f_8pysndlib_3clm_make_polywave(double __pyx_v_frequency, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_8pysndlib_3clm_make_polywave *__pyx_optional_args) {
PyObject *__pyx_v_partials = __pyx_k__34;
enum __pyx_t_8pysndlib_3clm_Polynomial __pyx_v_kind = __pyx_k__35;
PyObject *__pyx_v_xcoeffs = ((PyObject *)Py_None);
PyObject *__pyx_v_ycoeffs = ((PyObject *)Py_None);
__Pyx_memviewslice __pyx_v_xcoeffs_view = { 0, 0, { 0 }, { 0 }, { 0 } };
__Pyx_memviewslice __pyx_v_ycoeffs_view = { 0, 0, { 0 }, { 0 }, { 0 } };
PyObject *__pyx_v_xcoeffs_arr = NULL;
PyObject *__pyx_v_ycoeffs_arr = NULL;
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = NULL;
PyObject *__pyx_v_partials_arr = NULL;
PyObject *__pyx_v_p = NULL;
PyObject *__pyx_v_maxpartial = NULL;
PyObject *__pyx_v_prtls = NULL;
PyObject *__pyx_v_i = NULL;
PyObject *__pyx_v_curpartial = NULL;
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_r = NULL;
if (__pyx_optional_args) {
if (__pyx_optional_args->__pyx_n > 0) {
__pyx_v_partials = __pyx_optional_args->partials;
if (__pyx_optional_args->__pyx_n > 1) {
__pyx_v_kind = __pyx_optional_args->kind;
if (__pyx_optional_args->__pyx_n > 2) {
__pyx_v_xcoeffs = __pyx_optional_args->xcoeffs;
if (__pyx_optional_args->__pyx_n > 3) {
__pyx_v_ycoeffs = __pyx_optional_args->ycoeffs;
}
}
}
}
}
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__PYX_XCLEAR_MEMVIEW(&__pyx_t_6, 1);
__Pyx_XDECREF(__pyx_t_9);
__Pyx_XDECREF(__pyx_t_10);
__Pyx_AddTraceback("pysndlib.clm.make_polywave", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__PYX_XCLEAR_MEMVIEW(&__pyx_v_xcoeffs_view, 1);
__PYX_XCLEAR_MEMVIEW(&__pyx_v_ycoeffs_view, 1);
__Pyx_XDECREF(__pyx_v_xcoeffs_arr);
__Pyx_XDECREF(__pyx_v_ycoeffs_arr);
__Pyx_XDECREF((PyObject *)__pyx_v_gen);
__Pyx_XDECREF(__pyx_v_partials_arr);
__Pyx_XDECREF(__pyx_v_p);
__Pyx_XDECREF(__pyx_v_maxpartial);
__Pyx_XDECREF(__pyx_v_prtls);
__Pyx_XDECREF(__pyx_v_i);
__Pyx_XDECREF(__pyx_v_curpartial);
__Pyx_XGIVEREF((PyObject *)__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_185make_polywave(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_184make_polywave, "\n return a new polynomial-based waveshaping generator. make_polywave(440.0, partials=[1.0,1.0]) is\n the same \\in effect as make_oscil.\n \n :param frequency: polywave frequency\n :param partials: a list of harmonic numbers and their associated amplitudes\n :param kind: Chebyshev polynomial choice\n :param xcoeffs: tn for tu-sum case\n :param ycoeffs: un for tu-sum case\n :return: polywave gen\n :rtype: mus_any\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_185make_polywave = {"make_polywave", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_185make_polywave, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_184make_polywave};
static PyObject *__pyx_pw_8pysndlib_3clm_185make_polywave(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
double __pyx_v_frequency;
PyObject *__pyx_v_partials = 0;
enum __pyx_t_8pysndlib_3clm_Polynomial __pyx_v_kind;
PyObject *__pyx_v_xcoeffs = 0;
PyObject *__pyx_v_ycoeffs = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("make_polywave (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_frequency,&__pyx_n_s_partials,&__pyx_n_s_kind,&__pyx_n_s_xcoeffs,&__pyx_n_s_ycoeffs,0};
PyObject* values[5] = {0,0,0,0,0};
values[1] = __Pyx_Arg_NewRef_FASTCALL(__pyx_k__34);
values[3] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
values[4] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4);
CYTHON_FALLTHROUGH;
case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
CYTHON_FALLTHROUGH;
case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_frequency)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2319, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_partials);
if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2319, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 2:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_kind);
if (value) { values[2] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2319, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 3:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_xcoeffs);
if (value) { values[3] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2319, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 4:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_ycoeffs);
if (value) { values[4] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2319, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "make_polywave") < 0)) __PYX_ERR(0, 2319, __pyx_L3_error)
}
} else {
switch (__pyx_nargs) {
case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4);
CYTHON_FALLTHROUGH;
case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
CYTHON_FALLTHROUGH;
case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
break;
default: goto __pyx_L5_argtuple_error;
}
}
__pyx_v_frequency = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_frequency == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2319, __pyx_L3_error)
__pyx_v_partials = values[1];
if (values[2]) {
__pyx_v_kind = ((enum __pyx_t_8pysndlib_3clm_Polynomial)__Pyx_PyInt_As_enum____pyx_t_8pysndlib_3clm_Polynomial(values[2])); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2319, __pyx_L3_error)
} else {
__pyx_v_kind = __pyx_k__35;
}
__pyx_v_xcoeffs = values[3];
__pyx_v_ycoeffs = values[4];
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("make_polywave", 0, 1, 5, __pyx_nargs); __PYX_ERR(0, 2319, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.make_polywave", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_8pysndlib_3clm_184make_polywave(__pyx_self, __pyx_v_frequency, __pyx_v_partials, __pyx_v_kind, __pyx_v_xcoeffs, __pyx_v_ycoeffs);
/* function exit code */
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_184make_polywave(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_frequency, PyObject *__pyx_v_partials, enum __pyx_t_8pysndlib_3clm_Polynomial __pyx_v_kind, PyObject *__pyx_v_xcoeffs, PyObject *__pyx_v_ycoeffs) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_2.__pyx_n = 4;
__pyx_t_2.partials = __pyx_v_partials;
__pyx_t_2.kind = __pyx_v_kind;
__pyx_t_2.xcoeffs = __pyx_v_xcoeffs;
__pyx_t_2.ycoeffs = __pyx_v_ycoeffs;
__pyx_t_1 = ((PyObject *)__pyx_f_8pysndlib_3clm_make_polywave(__pyx_v_frequency, 0, &__pyx_t_2)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2319, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("pysndlib.clm.make_polywave", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_40 = PyList_New(2); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 2319, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
__Pyx_INCREF(__pyx_float_0_);
__Pyx_GIVEREF(__pyx_float_0_);
if (__Pyx_PyList_SET_ITEM(__pyx_t_40, 0, __pyx_float_0_)) __PYX_ERR(0, 2319, __pyx_L1_error);
__Pyx_INCREF(__pyx_float_1_);
__Pyx_GIVEREF(__pyx_float_1_);
if (__Pyx_PyList_SET_ITEM(__pyx_t_40, 1, __pyx_float_1_)) __PYX_ERR(0, 2319, __pyx_L1_error);
__pyx_k__34 = __pyx_t_40;
__Pyx_GIVEREF(__pyx_t_40);
__pyx_t_40 = 0;
__pyx_k__35 = __pyx_e_8pysndlib_3clm_FIRST_KIND;
/* … */
__pyx_tuple__304 = PyTuple_Pack(5, __pyx_n_s_frequency, __pyx_n_s_partials, __pyx_n_s_kind, __pyx_n_s_xcoeffs, __pyx_n_s_ycoeffs); if (unlikely(!__pyx_tuple__304)) __PYX_ERR(0, 2319, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__304);
__Pyx_GIVEREF(__pyx_tuple__304);
__pyx_t_40 = PyList_New(2); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 2319, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
__Pyx_INCREF(__pyx_float_0_);
__Pyx_GIVEREF(__pyx_float_0_);
if (__Pyx_PyList_SET_ITEM(__pyx_t_40, 0, __pyx_float_0_)) __PYX_ERR(0, 2319, __pyx_L1_error);
__Pyx_INCREF(__pyx_float_1_);
__Pyx_GIVEREF(__pyx_float_1_);
if (__Pyx_PyList_SET_ITEM(__pyx_t_40, 1, __pyx_float_1_)) __PYX_ERR(0, 2319, __pyx_L1_error);
__pyx_t_37 = __Pyx_Enum_Polynomial_to_py(__pyx_e_8pysndlib_3clm_FIRST_KIND); if (unlikely(!__pyx_t_37)) __PYX_ERR(0, 2319, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_37);
__pyx_t_43 = PyTuple_New(4); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 2319, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
__Pyx_GIVEREF(__pyx_t_40);
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_43, 0, __pyx_t_40)) __PYX_ERR(0, 2319, __pyx_L1_error);
__Pyx_GIVEREF(__pyx_t_37);
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_43, 1, __pyx_t_37)) __PYX_ERR(0, 2319, __pyx_L1_error);
__Pyx_INCREF(Py_None);
__Pyx_GIVEREF(Py_None);
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_43, 2, Py_None)) __PYX_ERR(0, 2319, __pyx_L1_error);
__Pyx_INCREF(Py_None);
__Pyx_GIVEREF(Py_None);
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_43, 3, Py_None)) __PYX_ERR(0, 2319, __pyx_L1_error);
__pyx_t_40 = 0;
__pyx_t_37 = 0;
__pyx_t_37 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_185make_polywave, 0, __pyx_n_s_make_polywave, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__305)); if (unlikely(!__pyx_t_37)) __PYX_ERR(0, 2319, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_37);
__Pyx_CyFunction_SetDefaultsTuple(__pyx_t_37, __pyx_t_43);
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
if (PyDict_SetItem(__pyx_d, __pyx_n_s_make_polywave, __pyx_t_37) < 0) __PYX_ERR(0, 2319, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_37); __pyx_t_37 = 0;
__pyx_codeobj__305 = (PyObject*)__Pyx_PyCode_New(5, 0, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__304, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_make_polywave, 2319, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__305)) __PYX_ERR(0, 2319, __pyx_L1_error)
/* … */
struct __pyx_opt_args_8pysndlib_3clm_make_polywave {
int __pyx_n;
PyObject *partials;
enum __pyx_t_8pysndlib_3clm_Polynomial kind;
PyObject *xcoeffs;
PyObject *ycoeffs;
};
2320: """
2321: return a new polynomial-based waveshaping generator. make_polywave(440.0, partials=[1.0,1.0]) is
2322: the same \in effect as make_oscil.
2323:
2324: :param frequency: polywave frequency
2325: :param partials: a list of harmonic numbers and their associated amplitudes
2326: :param kind: Chebyshev polynomial choice
2327: :param xcoeffs: tn for tu-sum case
2328: :param ycoeffs: un for tu-sum case
2329: :return: polywave gen
2330: :rtype: mus_any
2331: """
2332:
+2333: check_range('frequency', frequency, 0.0, get_srate() / 2)
__pyx_t_1 = PyFloat_FromDouble(__pyx_v_frequency); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2333, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __pyx_f_8pysndlib_3clm_get_srate(0); if (unlikely(__pyx_t_2 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2333, __pyx_L1_error) __pyx_t_3 = PyFloat_FromDouble((__pyx_t_2 / 2.0)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2333, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_5.__pyx_n = 2; __pyx_t_5.low = __pyx_float_0_0; __pyx_t_5.high = __pyx_t_3; __pyx_t_4 = __pyx_f_8pysndlib_3clm_check_range(__pyx_n_s_frequency, __pyx_t_1, 0, &__pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2333, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
2334:
+2335: cdef double [:] xcoeffs_view = None
__pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(Py_None, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 2335, __pyx_L1_error) __pyx_v_xcoeffs_view = __pyx_t_6; __pyx_t_6.memview = NULL; __pyx_t_6.data = NULL;
+2336: cdef double [:] ycoeffs_view = None
__pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(Py_None, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 2336, __pyx_L1_error) __pyx_v_ycoeffs_view = __pyx_t_6; __pyx_t_6.memview = NULL; __pyx_t_6.data = NULL;
2337:
2338:
+2339: if(isinstance(xcoeffs, np.ndarray | list) ) and (isinstance(ycoeffs, np.ndarray | list)):
__pyx_t_4 = PyNumber_Or(((PyObject *)__pyx_ptype_5numpy_ndarray), ((PyObject *)(&PyList_Type))); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2339, __pyx_L1_error) __Pyx_GOTREF((PyObject *)__pyx_t_4); __pyx_t_8 = __Pyx_TypeCheck(__pyx_v_xcoeffs, __pyx_t_4); __Pyx_DECREF((PyObject *)__pyx_t_4); __pyx_t_4 = 0; if (__pyx_t_8) { } else { __pyx_t_7 = __pyx_t_8; goto __pyx_L4_bool_binop_done; } __pyx_t_4 = PyNumber_Or(((PyObject *)__pyx_ptype_5numpy_ndarray), ((PyObject *)(&PyList_Type))); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2339, __pyx_L1_error) __Pyx_GOTREF((PyObject *)__pyx_t_4); __pyx_t_8 = __Pyx_TypeCheck(__pyx_v_ycoeffs, __pyx_t_4); __Pyx_DECREF((PyObject *)__pyx_t_4); __pyx_t_4 = 0; __pyx_t_7 = __pyx_t_8; __pyx_L4_bool_binop_done:; if (__pyx_t_7) { /* … */ }
+2340: xcoeffs_arr = np.array(xcoeffs, dtype=np.double)
__Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2340, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_array); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2340, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2340, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_INCREF(__pyx_v_xcoeffs); __Pyx_GIVEREF(__pyx_v_xcoeffs); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_xcoeffs)) __PYX_ERR(0, 2340, __pyx_L1_error); __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2340, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2340, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_double); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2340, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_t_10) < 0) __PYX_ERR(0, 2340, __pyx_L1_error) __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, __pyx_t_1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2340, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_xcoeffs_arr = __pyx_t_10; __pyx_t_10 = 0;
+2341: xcoeffs_view = xcoeffs_arr
__pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_v_xcoeffs_arr, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 2341, __pyx_L1_error) __PYX_XCLEAR_MEMVIEW(&__pyx_v_xcoeffs_view, 1); __pyx_v_xcoeffs_view = __pyx_t_6; __pyx_t_6.memview = NULL; __pyx_t_6.data = NULL;
+2342: ycoeffs_arr = np.array(ycoeffs, dtype=np.double)
__Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_np); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2342, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_array); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2342, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2342, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __Pyx_INCREF(__pyx_v_ycoeffs); __Pyx_GIVEREF(__pyx_v_ycoeffs); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_v_ycoeffs)) __PYX_ERR(0, 2342, __pyx_L1_error); __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2342, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2342, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_double); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2342, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_dtype, __pyx_t_9) < 0) __PYX_ERR(0, 2342, __pyx_L1_error) __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_10, __pyx_t_4); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2342, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_v_ycoeffs_arr = __pyx_t_9; __pyx_t_9 = 0;
+2343: ycoeffs_view = ycoeffs_arr
__pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_v_ycoeffs_arr, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 2343, __pyx_L1_error) __PYX_XCLEAR_MEMVIEW(&__pyx_v_ycoeffs_view, 1); __pyx_v_ycoeffs_view = __pyx_t_6; __pyx_t_6.memview = NULL; __pyx_t_6.data = NULL;
+2344: check_ndim(xcoeffs_arr)
__pyx_t_9 = __pyx_f_8pysndlib_3clm_check_ndim(__pyx_v_xcoeffs_arr, 0, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2344, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+2345: check_ndim(ycoeffs_arr)
__pyx_t_9 = __pyx_f_8pysndlib_3clm_check_ndim(__pyx_v_ycoeffs_arr, 0, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2345, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+2346: compare_shapes(xcoeffs_arr, ycoeffs_arr)
__pyx_t_9 = __pyx_f_8pysndlib_3clm_compare_shapes(__pyx_v_xcoeffs_arr, __pyx_v_ycoeffs_arr, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2346, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
2347:
+2348: gen = mus_any.from_ptr(cclm.mus_make_polywave_tu(frequency,&xcoeffs_view[0],&ycoeffs_view[0], len(xcoeffs_arr)))
__pyx_t_11 = 0;
__pyx_t_12 = -1;
if (__pyx_t_11 < 0) {
__pyx_t_11 += __pyx_v_xcoeffs_view.shape[0];
if (unlikely(__pyx_t_11 < 0)) __pyx_t_12 = 0;
} else if (unlikely(__pyx_t_11 >= __pyx_v_xcoeffs_view.shape[0])) __pyx_t_12 = 0;
if (unlikely(__pyx_t_12 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_12);
__PYX_ERR(0, 2348, __pyx_L1_error)
}
__pyx_t_13 = 0;
__pyx_t_12 = -1;
if (__pyx_t_13 < 0) {
__pyx_t_13 += __pyx_v_ycoeffs_view.shape[0];
if (unlikely(__pyx_t_13 < 0)) __pyx_t_12 = 0;
} else if (unlikely(__pyx_t_13 >= __pyx_v_ycoeffs_view.shape[0])) __pyx_t_12 = 0;
if (unlikely(__pyx_t_12 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_12);
__PYX_ERR(0, 2348, __pyx_L1_error)
}
__pyx_t_14 = PyObject_Length(__pyx_v_xcoeffs_arr); if (unlikely(__pyx_t_14 == ((Py_ssize_t)-1))) __PYX_ERR(0, 2348, __pyx_L1_error)
__pyx_t_9 = ((PyObject *)__pyx_vtabptr_8pysndlib_3clm_mus_any->from_ptr(mus_make_polywave_tu(__pyx_v_frequency, (&(*((double *) ( /* dim=0 */ (__pyx_v_xcoeffs_view.data + __pyx_t_11 * __pyx_v_xcoeffs_view.strides[0]) )))), (&(*((double *) ( /* dim=0 */ (__pyx_v_ycoeffs_view.data + __pyx_t_13 * __pyx_v_ycoeffs_view.strides[0]) )))), __pyx_t_14), NULL)); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2348, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_9);
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_t_9);
__pyx_t_9 = 0;
+2349: gen.cache_extend([xcoeffs_arr, ycoeffs_arr])
__pyx_t_9 = PyList_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2349, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_INCREF(__pyx_v_xcoeffs_arr); __Pyx_GIVEREF(__pyx_v_xcoeffs_arr); if (__Pyx_PyList_SET_ITEM(__pyx_t_9, 0, __pyx_v_xcoeffs_arr)) __PYX_ERR(0, 2349, __pyx_L1_error); __Pyx_INCREF(__pyx_v_ycoeffs_arr); __Pyx_GIVEREF(__pyx_v_ycoeffs_arr); if (__Pyx_PyList_SET_ITEM(__pyx_t_9, 1, __pyx_v_ycoeffs_arr)) __PYX_ERR(0, 2349, __pyx_L1_error); __pyx_t_4 = ((struct __pyx_vtabstruct_8pysndlib_3clm_mus_any *)__pyx_v_gen->__pyx_vtab)->cache_extend(__pyx_v_gen, __pyx_t_9, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2349, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+2350: return gen
__Pyx_XDECREF((PyObject *)__pyx_r); __Pyx_INCREF((PyObject *)__pyx_v_gen); __pyx_r = __pyx_v_gen; goto __pyx_L0;
2351: else:
+2352: partials_arr = None
/*else*/ {
__Pyx_INCREF(Py_None);
__pyx_v_partials_arr = Py_None;
2353:
+2354: if isinstance(partials, np.ndarray):
__pyx_t_7 = __Pyx_TypeCheck(__pyx_v_partials, __pyx_ptype_5numpy_ndarray);
if (__pyx_t_7) {
/* … */
}
+2355: partials_arr = partials
__Pyx_INCREF(__pyx_v_partials); __Pyx_DECREF_SET(__pyx_v_partials_arr, __pyx_v_partials);
+2356: if isinstance(partials, list):
__pyx_t_7 = PyList_Check(__pyx_v_partials);
if (__pyx_t_7) {
/* … */
}
+2357: partials_arr = np.array(partials, dtype=np.double)
__Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2357, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_array); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2357, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2357, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_INCREF(__pyx_v_partials); __Pyx_GIVEREF(__pyx_v_partials); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_partials)) __PYX_ERR(0, 2357, __pyx_L1_error); __pyx_t_10 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2357, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2357, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_double); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2357, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (PyDict_SetItem(__pyx_t_10, __pyx_n_s_dtype, __pyx_t_3) < 0) __PYX_ERR(0, 2357, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_4, __pyx_t_10); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2357, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __Pyx_DECREF_SET(__pyx_v_partials_arr, __pyx_t_3); __pyx_t_3 = 0;
2358:
+2359: p = partials_arr[::2]
__pyx_t_3 = __Pyx_PyObject_GetItem(__pyx_v_partials_arr, __pyx_slice__18); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2359, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_v_p = __pyx_t_3; __pyx_t_3 = 0;
+2360: maxpartial = max(p)
__pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_max, __pyx_v_p); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2360, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_v_maxpartial = __pyx_t_3; __pyx_t_3 = 0;
2361:
+2362: prtls = np.zeros(int(maxpartial)+1, dtype=np.double)
__Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2362, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2362, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = __Pyx_PyNumber_Int(__pyx_v_maxpartial); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2362, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = __Pyx_PyInt_AddObjC(__pyx_t_3, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2362, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2362, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_GIVEREF(__pyx_t_4); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4)) __PYX_ERR(0, 2362, __pyx_L1_error); __pyx_t_4 = 0; __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2362, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2362, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_double); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2362, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_dtype, __pyx_t_1) < 0) __PYX_ERR(0, 2362, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2362, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_v_prtls = __pyx_t_1; __pyx_t_1 = 0;
2363:
+2364: check_ndim(prtls)
__pyx_t_1 = __pyx_f_8pysndlib_3clm_check_ndim(__pyx_v_prtls, 0, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2364, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2365:
+2366: for i in range(0, len(partials_arr),2):
__pyx_t_14 = PyObject_Length(__pyx_v_partials_arr); if (unlikely(__pyx_t_14 == ((Py_ssize_t)-1))) __PYX_ERR(0, 2366, __pyx_L1_error) __pyx_t_1 = PyInt_FromSsize_t(__pyx_t_14); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2366, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2366, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_INCREF(__pyx_int_0); __Pyx_GIVEREF(__pyx_int_0); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_int_0)) __PYX_ERR(0, 2366, __pyx_L1_error); __Pyx_GIVEREF(__pyx_t_1); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1)) __PYX_ERR(0, 2366, __pyx_L1_error); __Pyx_INCREF(__pyx_int_2); __Pyx_GIVEREF(__pyx_int_2); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_int_2)) __PYX_ERR(0, 2366, __pyx_L1_error); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2366, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) { __pyx_t_4 = __pyx_t_1; __Pyx_INCREF(__pyx_t_4); __pyx_t_14 = 0; __pyx_t_15 = NULL; } else { __pyx_t_14 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2366, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_15 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_4); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 2366, __pyx_L1_error) } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; for (;;) { if (likely(!__pyx_t_15)) { if (likely(PyList_CheckExact(__pyx_t_4))) { { Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_4); #if !CYTHON_ASSUME_SAFE_MACROS if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 2366, __pyx_L1_error) #endif if (__pyx_t_14 >= __pyx_temp) break; } #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS __pyx_t_1 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_14); __Pyx_INCREF(__pyx_t_1); __pyx_t_14++; if (unlikely((0 < 0))) __PYX_ERR(0, 2366, __pyx_L1_error) #else __pyx_t_1 = __Pyx_PySequence_ITEM(__pyx_t_4, __pyx_t_14); __pyx_t_14++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2366, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); #endif } else { { Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_4); #if !CYTHON_ASSUME_SAFE_MACROS if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 2366, __pyx_L1_error) #endif if (__pyx_t_14 >= __pyx_temp) break; } #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_14); __Pyx_INCREF(__pyx_t_1); __pyx_t_14++; if (unlikely((0 < 0))) __PYX_ERR(0, 2366, __pyx_L1_error) #else __pyx_t_1 = __Pyx_PySequence_ITEM(__pyx_t_4, __pyx_t_14); __pyx_t_14++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2366, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); #endif } } else { __pyx_t_1 = __pyx_t_15(__pyx_t_4); if (unlikely(!__pyx_t_1)) { PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); else __PYX_ERR(0, 2366, __pyx_L1_error) } break; } __Pyx_GOTREF(__pyx_t_1); } __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_1); __pyx_t_1 = 0; /* … */ } __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+2367: curpartial = partials_arr[i]
__pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_v_partials_arr, __pyx_v_i); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2367, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_XDECREF_SET(__pyx_v_curpartial, __pyx_t_1); __pyx_t_1 = 0;
+2368: prtls[int(curpartial)] = partials_arr[i+1]
__pyx_t_1 = __Pyx_PyInt_AddObjC(__pyx_v_i, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2368, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = __Pyx_PyObject_GetItem(__pyx_v_partials_arr, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2368, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_PyNumber_Int(__pyx_v_curpartial); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2368, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (unlikely((PyObject_SetItem(__pyx_v_prtls, __pyx_t_1, __pyx_t_3) < 0))) __PYX_ERR(0, 2368, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
2369:
+2370: xcoeffs_view = prtls
__pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_v_prtls, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 2370, __pyx_L1_error) __PYX_XCLEAR_MEMVIEW(&__pyx_v_xcoeffs_view, 1); __pyx_v_xcoeffs_view = __pyx_t_6; __pyx_t_6.memview = NULL; __pyx_t_6.data = NULL;
2371:
+2372: gen = mus_any.from_ptr(cclm.mus_make_polywave(frequency, &xcoeffs_view[0], len(prtls), kind))
__pyx_t_13 = 0;
__pyx_t_12 = -1;
if (__pyx_t_13 < 0) {
__pyx_t_13 += __pyx_v_xcoeffs_view.shape[0];
if (unlikely(__pyx_t_13 < 0)) __pyx_t_12 = 0;
} else if (unlikely(__pyx_t_13 >= __pyx_v_xcoeffs_view.shape[0])) __pyx_t_12 = 0;
if (unlikely(__pyx_t_12 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_12);
__PYX_ERR(0, 2372, __pyx_L1_error)
}
__pyx_t_14 = PyObject_Length(__pyx_v_prtls); if (unlikely(__pyx_t_14 == ((Py_ssize_t)-1))) __PYX_ERR(0, 2372, __pyx_L1_error)
__pyx_t_4 = ((PyObject *)__pyx_vtabptr_8pysndlib_3clm_mus_any->from_ptr(mus_make_polywave(__pyx_v_frequency, (&(*((double *) ( /* dim=0 */ (__pyx_v_xcoeffs_view.data + __pyx_t_13 * __pyx_v_xcoeffs_view.strides[0]) )))), __pyx_t_14, __pyx_v_kind), NULL)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2372, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_t_4);
__pyx_t_4 = 0;
2373:
+2374: gen.cache_extend([prtls])
__pyx_t_4 = PyList_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2374, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_INCREF(__pyx_v_prtls); __Pyx_GIVEREF(__pyx_v_prtls); if (__Pyx_PyList_SET_ITEM(__pyx_t_4, 0, __pyx_v_prtls)) __PYX_ERR(0, 2374, __pyx_L1_error); __pyx_t_3 = ((struct __pyx_vtabstruct_8pysndlib_3clm_mus_any *)__pyx_v_gen->__pyx_vtab)->cache_extend(__pyx_v_gen, __pyx_t_4, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2374, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+2375: return gen
__Pyx_XDECREF((PyObject *)__pyx_r); __Pyx_INCREF((PyObject *)__pyx_v_gen); __pyx_r = __pyx_v_gen; goto __pyx_L0; }
2376:
2377:
+2378: cpdef cython.double polywave(mus_any gen, cython.double fm=0.0):
static PyObject *__pyx_pw_8pysndlib_3clm_187polywave(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static double __pyx_f_8pysndlib_3clm_polywave(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_8pysndlib_3clm_polywave *__pyx_optional_args) {
double __pyx_v_fm = ((double)0.0);
double __pyx_r;
if (__pyx_optional_args) {
if (__pyx_optional_args->__pyx_n > 0) {
__pyx_v_fm = __pyx_optional_args->fm;
}
}
/* … */
/* function exit code */
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_187polywave(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_186polywave, "\n next sample of polywave waveshaper.\n \n :param gen: polywave gen\n :param fm: fm input\n :rtype: float\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_187polywave = {"polywave", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_187polywave, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_186polywave};
static PyObject *__pyx_pw_8pysndlib_3clm_187polywave(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = 0;
double __pyx_v_fm;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("polywave (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gen,&__pyx_n_s_fm,0};
PyObject* values[2] = {0,0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_gen)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2378, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_fm);
if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2378, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "polywave") < 0)) __PYX_ERR(0, 2378, __pyx_L3_error)
}
} else {
switch (__pyx_nargs) {
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
break;
default: goto __pyx_L5_argtuple_error;
}
}
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)values[0]);
if (values[1]) {
__pyx_v_fm = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_fm == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2378, __pyx_L3_error)
} else {
__pyx_v_fm = ((double)0.0);
}
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("polywave", 0, 1, 2, __pyx_nargs); __PYX_ERR(0, 2378, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.polywave", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gen), __pyx_ptype_8pysndlib_3clm_mus_any, 1, "gen", 0))) __PYX_ERR(0, 2378, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_186polywave(__pyx_self, __pyx_v_gen, __pyx_v_fm);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_186polywave(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, double __pyx_v_fm) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_2.__pyx_n = 1;
__pyx_t_2.fm = __pyx_v_fm;
__pyx_t_1 = __pyx_f_8pysndlib_3clm_polywave(__pyx_v_gen, 0, &__pyx_t_2); if (unlikely(__pyx_t_1 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2378, __pyx_L1_error)
__pyx_t_3 = PyFloat_FromDouble(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2378, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__pyx_r = __pyx_t_3;
__pyx_t_3 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_3);
__Pyx_AddTraceback("pysndlib.clm.polywave", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_codeobj__306 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__291, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_polywave, 2378, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__306)) __PYX_ERR(0, 2378, __pyx_L1_error)
/* … */
__pyx_t_37 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_187polywave, 0, __pyx_n_s_polywave, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__306)); if (unlikely(!__pyx_t_37)) __PYX_ERR(0, 2378, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_37);
__Pyx_CyFunction_SetDefaultsTuple(__pyx_t_37, __pyx_tuple__307);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_polywave, __pyx_t_37) < 0) __PYX_ERR(0, 2378, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_37); __pyx_t_37 = 0;
__pyx_tuple__307 = PyTuple_Pack(1, __pyx_float_0_0); if (unlikely(!__pyx_tuple__307)) __PYX_ERR(0, 2378, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__307);
__Pyx_GIVEREF(__pyx_tuple__307);
2379: """
2380: next sample of polywave waveshaper.
2381:
2382: :param gen: polywave gen
2383: :param fm: fm input
2384: :rtype: float
2385: """
+2386: return cclm.mus_polywave(gen._ptr, fm)
__pyx_r = mus_polywave(__pyx_v_gen->_ptr, __pyx_v_fm); goto __pyx_L0;
2387:
2388:
+2389: cpdef cython.double polywave_unmodulated(mus_any gen):
static PyObject *__pyx_pw_8pysndlib_3clm_189polywave_unmodulated(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static double __pyx_f_8pysndlib_3clm_polywave_unmodulated(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, CYTHON_UNUSED int __pyx_skip_dispatch) {
double __pyx_r;
/* … */
/* function exit code */
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_189polywave_unmodulated(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_188polywave_unmodulated, "\n next sample of polywave waveshaper. unmodulated\n \n :param gen: polywave gen\n :rtype: float\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_189polywave_unmodulated = {"polywave_unmodulated", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_189polywave_unmodulated, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_188polywave_unmodulated};
static PyObject *__pyx_pw_8pysndlib_3clm_189polywave_unmodulated(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("polywave_unmodulated (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gen,0};
PyObject* values[1] = {0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_gen)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2389, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "polywave_unmodulated") < 0)) __PYX_ERR(0, 2389, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 1)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
}
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)values[0]);
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("polywave_unmodulated", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 2389, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.polywave_unmodulated", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gen), __pyx_ptype_8pysndlib_3clm_mus_any, 1, "gen", 0))) __PYX_ERR(0, 2389, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_188polywave_unmodulated(__pyx_self, __pyx_v_gen);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_188polywave_unmodulated(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8pysndlib_3clm_polywave_unmodulated(__pyx_v_gen, 0); if (unlikely(__pyx_t_1 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2389, __pyx_L1_error)
__pyx_t_2 = PyFloat_FromDouble(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2389, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("pysndlib.clm.polywave_unmodulated", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_37 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_189polywave_unmodulated, 0, __pyx_n_s_polywave_unmodulated, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__308)); if (unlikely(!__pyx_t_37)) __PYX_ERR(0, 2389, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_37);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_polywave_unmodulated, __pyx_t_37) < 0) __PYX_ERR(0, 2389, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_37); __pyx_t_37 = 0;
/* … */
__pyx_codeobj__308 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__56, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_polywave_unmodulated, 2389, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__308)) __PYX_ERR(0, 2389, __pyx_L1_error)
2390: """
2391: next sample of polywave waveshaper. unmodulated
2392:
2393: :param gen: polywave gen
2394: :rtype: float
2395: """
+2396: return cclm.mus_polywave_unmodulated(gen._ptr)
__pyx_r = mus_polywave_unmodulated(__pyx_v_gen->_ptr); goto __pyx_L0;
2397:
+2398: cpdef bint is_polywave(mus_any gen):
static PyObject *__pyx_pw_8pysndlib_3clm_191is_polywave(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static int __pyx_f_8pysndlib_3clm_is_polywave(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, CYTHON_UNUSED int __pyx_skip_dispatch) {
int __pyx_r;
/* … */
/* function exit code */
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_191is_polywave(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_190is_polywave, "\n returns True if gen is a polywave.\n \n :param gen: gen\n :rtype: bool\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_191is_polywave = {"is_polywave", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_191is_polywave, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_190is_polywave};
static PyObject *__pyx_pw_8pysndlib_3clm_191is_polywave(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("is_polywave (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gen,0};
PyObject* values[1] = {0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_gen)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2398, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "is_polywave") < 0)) __PYX_ERR(0, 2398, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 1)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
}
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)values[0]);
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("is_polywave", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 2398, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.is_polywave", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gen), __pyx_ptype_8pysndlib_3clm_mus_any, 1, "gen", 0))) __PYX_ERR(0, 2398, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_190is_polywave(__pyx_self, __pyx_v_gen);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_190is_polywave(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8pysndlib_3clm_is_polywave(__pyx_v_gen, 0); if (unlikely(__pyx_t_1 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2398, __pyx_L1_error)
__pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2398, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("pysndlib.clm.is_polywave", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_37 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_191is_polywave, 0, __pyx_n_s_is_polywave, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__309)); if (unlikely(!__pyx_t_37)) __PYX_ERR(0, 2398, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_37);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_is_polywave, __pyx_t_37) < 0) __PYX_ERR(0, 2398, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_37); __pyx_t_37 = 0;
/* … */
__pyx_codeobj__309 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__56, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_is_polywave, 2398, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__309)) __PYX_ERR(0, 2398, __pyx_L1_error)
2399: """
2400: returns True if gen is a polywave.
2401:
2402: :param gen: gen
2403: :rtype: bool
2404: """
+2405: return cclm.mus_is_polywave(gen._ptr)
__pyx_r = mus_is_polywave(__pyx_v_gen->_ptr); goto __pyx_L0;
2406:
2407:
2408:
2409: # ---------------- polyshape ---------------- #
2410:
+2411: cpdef mus_any make_polyshape(cython.double frequency, cython.double initial_phase=0.0, coeffs = None, partials = [1.,1.], Polynomial kind=Polynomial.FIRST_KIND):
static PyObject *__pyx_pw_8pysndlib_3clm_193make_polyshape(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_f_8pysndlib_3clm_make_polyshape(double __pyx_v_frequency, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_8pysndlib_3clm_make_polyshape *__pyx_optional_args) {
double __pyx_v_initial_phase = ((double)0.0);
PyObject *__pyx_v_coeffs = ((PyObject *)Py_None);
PyObject *__pyx_v_partials = __pyx_k__36;
enum __pyx_t_8pysndlib_3clm_Polynomial __pyx_v_kind = __pyx_k__37;
PyObject *__pyx_v_data = NULL;
__Pyx_memviewslice __pyx_v_data_view = { 0, 0, { 0 }, { 0 }, { 0 } };
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = NULL;
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_r = NULL;
if (__pyx_optional_args) {
if (__pyx_optional_args->__pyx_n > 0) {
__pyx_v_initial_phase = __pyx_optional_args->initial_phase;
if (__pyx_optional_args->__pyx_n > 1) {
__pyx_v_coeffs = __pyx_optional_args->coeffs;
if (__pyx_optional_args->__pyx_n > 2) {
__pyx_v_partials = __pyx_optional_args->partials;
if (__pyx_optional_args->__pyx_n > 3) {
__pyx_v_kind = __pyx_optional_args->kind;
}
}
}
}
}
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_XDECREF(__pyx_t_7);
__Pyx_XDECREF(__pyx_t_8);
__PYX_XCLEAR_MEMVIEW(&__pyx_t_10, 1);
__Pyx_AddTraceback("pysndlib.clm.make_polyshape", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XDECREF(__pyx_v_data);
__PYX_XCLEAR_MEMVIEW(&__pyx_v_data_view, 1);
__Pyx_XDECREF((PyObject *)__pyx_v_gen);
__Pyx_XGIVEREF((PyObject *)__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_193make_polyshape(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_192make_polyshape, "\n return a new polynomial-based waveshaping generator.\n \n :param frequency: frequency of gen \\in hz\n :param initial_phase: initial phase of gen \\in radians\n :param coeff: coefficients can be passed to polyshape\n :param partials: a list of harmonic numbers and their associated amplitudes\n :param kind: Chebyshev polynomial choice\n :return: polyshape gen\n :rtype: mus_any\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_193make_polyshape = {"make_polyshape", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_193make_polyshape, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_192make_polyshape};
static PyObject *__pyx_pw_8pysndlib_3clm_193make_polyshape(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
double __pyx_v_frequency;
double __pyx_v_initial_phase;
PyObject *__pyx_v_coeffs = 0;
PyObject *__pyx_v_partials = 0;
enum __pyx_t_8pysndlib_3clm_Polynomial __pyx_v_kind;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("make_polyshape (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_frequency,&__pyx_n_s_initial_phase,&__pyx_n_s_coeffs,&__pyx_n_s_partials,&__pyx_n_s_kind,0};
PyObject* values[5] = {0,0,0,0,0};
values[2] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
values[3] = __Pyx_Arg_NewRef_FASTCALL(__pyx_k__36);
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4);
CYTHON_FALLTHROUGH;
case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
CYTHON_FALLTHROUGH;
case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_frequency)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2411, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_initial_phase);
if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2411, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 2:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_coeffs);
if (value) { values[2] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2411, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 3:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_partials);
if (value) { values[3] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2411, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 4:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_kind);
if (value) { values[4] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2411, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "make_polyshape") < 0)) __PYX_ERR(0, 2411, __pyx_L3_error)
}
} else {
switch (__pyx_nargs) {
case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4);
CYTHON_FALLTHROUGH;
case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
CYTHON_FALLTHROUGH;
case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
break;
default: goto __pyx_L5_argtuple_error;
}
}
__pyx_v_frequency = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_frequency == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2411, __pyx_L3_error)
if (values[1]) {
__pyx_v_initial_phase = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_initial_phase == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2411, __pyx_L3_error)
} else {
__pyx_v_initial_phase = ((double)0.0);
}
__pyx_v_coeffs = values[2];
__pyx_v_partials = values[3];
if (values[4]) {
__pyx_v_kind = ((enum __pyx_t_8pysndlib_3clm_Polynomial)__Pyx_PyInt_As_enum____pyx_t_8pysndlib_3clm_Polynomial(values[4])); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2411, __pyx_L3_error)
} else {
__pyx_v_kind = __pyx_k__37;
}
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("make_polyshape", 0, 1, 5, __pyx_nargs); __PYX_ERR(0, 2411, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.make_polyshape", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_8pysndlib_3clm_192make_polyshape(__pyx_self, __pyx_v_frequency, __pyx_v_initial_phase, __pyx_v_coeffs, __pyx_v_partials, __pyx_v_kind);
/* function exit code */
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_192make_polyshape(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_frequency, double __pyx_v_initial_phase, PyObject *__pyx_v_coeffs, PyObject *__pyx_v_partials, enum __pyx_t_8pysndlib_3clm_Polynomial __pyx_v_kind) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_2.__pyx_n = 4;
__pyx_t_2.initial_phase = __pyx_v_initial_phase;
__pyx_t_2.coeffs = __pyx_v_coeffs;
__pyx_t_2.partials = __pyx_v_partials;
__pyx_t_2.kind = __pyx_v_kind;
__pyx_t_1 = ((PyObject *)__pyx_f_8pysndlib_3clm_make_polyshape(__pyx_v_frequency, 0, &__pyx_t_2)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2411, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("pysndlib.clm.make_polyshape", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_37 = PyList_New(2); if (unlikely(!__pyx_t_37)) __PYX_ERR(0, 2411, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_37);
__Pyx_INCREF(__pyx_float_1_);
__Pyx_GIVEREF(__pyx_float_1_);
if (__Pyx_PyList_SET_ITEM(__pyx_t_37, 0, __pyx_float_1_)) __PYX_ERR(0, 2411, __pyx_L1_error);
__Pyx_INCREF(__pyx_float_1_);
__Pyx_GIVEREF(__pyx_float_1_);
if (__Pyx_PyList_SET_ITEM(__pyx_t_37, 1, __pyx_float_1_)) __PYX_ERR(0, 2411, __pyx_L1_error);
__pyx_k__36 = __pyx_t_37;
__Pyx_GIVEREF(__pyx_t_37);
__pyx_t_37 = 0;
__pyx_k__37 = __pyx_e_8pysndlib_3clm_FIRST_KIND;
/* … */
__pyx_tuple__310 = PyTuple_Pack(5, __pyx_n_s_frequency, __pyx_n_s_initial_phase, __pyx_n_s_coeffs, __pyx_n_s_partials, __pyx_n_s_kind); if (unlikely(!__pyx_tuple__310)) __PYX_ERR(0, 2411, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__310);
__Pyx_GIVEREF(__pyx_tuple__310);
__pyx_t_37 = PyList_New(2); if (unlikely(!__pyx_t_37)) __PYX_ERR(0, 2411, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_37);
__Pyx_INCREF(__pyx_float_1_);
__Pyx_GIVEREF(__pyx_float_1_);
if (__Pyx_PyList_SET_ITEM(__pyx_t_37, 0, __pyx_float_1_)) __PYX_ERR(0, 2411, __pyx_L1_error);
__Pyx_INCREF(__pyx_float_1_);
__Pyx_GIVEREF(__pyx_float_1_);
if (__Pyx_PyList_SET_ITEM(__pyx_t_37, 1, __pyx_float_1_)) __PYX_ERR(0, 2411, __pyx_L1_error);
__pyx_t_43 = __Pyx_Enum_Polynomial_to_py(__pyx_e_8pysndlib_3clm_FIRST_KIND); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 2411, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
__pyx_t_40 = PyTuple_New(4); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 2411, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
__Pyx_INCREF(__pyx_float_0_0);
__Pyx_GIVEREF(__pyx_float_0_0);
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_40, 0, __pyx_float_0_0)) __PYX_ERR(0, 2411, __pyx_L1_error);
__Pyx_INCREF(Py_None);
__Pyx_GIVEREF(Py_None);
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_40, 1, Py_None)) __PYX_ERR(0, 2411, __pyx_L1_error);
__Pyx_GIVEREF(__pyx_t_37);
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_40, 2, __pyx_t_37)) __PYX_ERR(0, 2411, __pyx_L1_error);
__Pyx_GIVEREF(__pyx_t_43);
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_40, 3, __pyx_t_43)) __PYX_ERR(0, 2411, __pyx_L1_error);
__pyx_t_37 = 0;
__pyx_t_43 = 0;
__pyx_t_43 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_193make_polyshape, 0, __pyx_n_s_make_polyshape, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__311)); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 2411, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
__Pyx_CyFunction_SetDefaultsTuple(__pyx_t_43, __pyx_t_40);
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
if (PyDict_SetItem(__pyx_d, __pyx_n_s_make_polyshape, __pyx_t_43) < 0) __PYX_ERR(0, 2411, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
__pyx_codeobj__311 = (PyObject*)__Pyx_PyCode_New(5, 0, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__310, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_make_polyshape, 2411, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__311)) __PYX_ERR(0, 2411, __pyx_L1_error)
/* … */
struct __pyx_opt_args_8pysndlib_3clm_make_polyshape {
int __pyx_n;
double initial_phase;
PyObject *coeffs;
PyObject *partials;
enum __pyx_t_8pysndlib_3clm_Polynomial kind;
};
2412:
2413: """
2414: return a new polynomial-based waveshaping generator.
2415:
2416: :param frequency: frequency of gen \in hz
2417: :param initial_phase: initial phase of gen \in radians
2418: :param coeff: coefficients can be passed to polyshape
2419: :param partials: a list of harmonic numbers and their associated amplitudes
2420: :param kind: Chebyshev polynomial choice
2421: :return: polyshape gen
2422: :rtype: mus_any
2423: """
2424:
+2425: check_range('frequency', frequency, 0.0, get_srate() / 2)
__pyx_t_1 = PyFloat_FromDouble(__pyx_v_frequency); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2425, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __pyx_f_8pysndlib_3clm_get_srate(0); if (unlikely(__pyx_t_2 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2425, __pyx_L1_error) __pyx_t_3 = PyFloat_FromDouble((__pyx_t_2 / 2.0)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2425, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_5.__pyx_n = 2; __pyx_t_5.low = __pyx_float_0_0; __pyx_t_5.high = __pyx_t_3; __pyx_t_4 = __pyx_f_8pysndlib_3clm_check_range(__pyx_n_s_frequency, __pyx_t_1, 0, &__pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2425, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
2426:
+2427: if coeffs:
__pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_coeffs); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 2427, __pyx_L1_error) if (__pyx_t_6) { /* … */ goto __pyx_L3; }
+2428: if isinstance(coeffs, list):
__pyx_t_6 = PyList_Check(__pyx_v_coeffs);
if (__pyx_t_6) {
/* … */
goto __pyx_L4;
}
+2429: data = np.array(coeffs, dtype=np.double)
__Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2429, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_array); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2429, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2429, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_INCREF(__pyx_v_coeffs); __Pyx_GIVEREF(__pyx_v_coeffs); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_coeffs)) __PYX_ERR(0, 2429, __pyx_L1_error); __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2429, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2429, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_double); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2429, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_t_8) < 0) __PYX_ERR(0, 2429, __pyx_L1_error) __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, __pyx_t_1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2429, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_data = __pyx_t_8; __pyx_t_8 = 0;
2430: else:
+2431: data = coeffs
/*else*/ {
__Pyx_INCREF(__pyx_v_coeffs);
__pyx_v_data = __pyx_v_coeffs;
}
__pyx_L4:;
2432:
2433: else:
+2434: data = partials2polynomial(partials, kind)
/*else*/ {
__pyx_t_9.__pyx_n = 1;
__pyx_t_9.kind = __pyx_v_kind;
__pyx_t_8 = ((PyObject *)__pyx_f_8pysndlib_3clm_partials2polynomial(__pyx_v_partials, 0, &__pyx_t_9)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2434, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_8);
__pyx_v_data = __pyx_t_8;
__pyx_t_8 = 0;
}
__pyx_L3:;
2435:
+2436: check_ndim(data)
__pyx_t_8 = __pyx_f_8pysndlib_3clm_check_ndim(__pyx_v_data, 0, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2436, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
2437:
+2438: cdef double [:] data_view = data
__pyx_t_10 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_v_data, PyBUF_WRITABLE); if (unlikely(!__pyx_t_10.memview)) __PYX_ERR(0, 2438, __pyx_L1_error) __pyx_v_data_view = __pyx_t_10; __pyx_t_10.memview = NULL; __pyx_t_10.data = NULL;
2439:
+2440: gen = mus_any.from_ptr(cclm.mus_make_polyshape(frequency, initial_phase, &data_view[0], len(data), kind))
__pyx_t_11 = 0;
__pyx_t_12 = -1;
if (__pyx_t_11 < 0) {
__pyx_t_11 += __pyx_v_data_view.shape[0];
if (unlikely(__pyx_t_11 < 0)) __pyx_t_12 = 0;
} else if (unlikely(__pyx_t_11 >= __pyx_v_data_view.shape[0])) __pyx_t_12 = 0;
if (unlikely(__pyx_t_12 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_12);
__PYX_ERR(0, 2440, __pyx_L1_error)
}
__pyx_t_13 = PyObject_Length(__pyx_v_data); if (unlikely(__pyx_t_13 == ((Py_ssize_t)-1))) __PYX_ERR(0, 2440, __pyx_L1_error)
__pyx_t_8 = ((PyObject *)__pyx_vtabptr_8pysndlib_3clm_mus_any->from_ptr(mus_make_polyshape(__pyx_v_frequency, __pyx_v_initial_phase, (&(*((double *) ( /* dim=0 */ (__pyx_v_data_view.data + __pyx_t_11 * __pyx_v_data_view.strides[0]) )))), __pyx_t_13, __pyx_v_kind), NULL)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2440, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_8);
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_t_8);
__pyx_t_8 = 0;
+2441: gen.cache_append(data)
__pyx_t_8 = ((struct __pyx_vtabstruct_8pysndlib_3clm_mus_any *)__pyx_v_gen->__pyx_vtab)->cache_append(__pyx_v_gen, __pyx_v_data, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2441, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+2442: return gen
__Pyx_XDECREF((PyObject *)__pyx_r); __Pyx_INCREF((PyObject *)__pyx_v_gen); __pyx_r = __pyx_v_gen; goto __pyx_L0;
2443:
+2444: cpdef cython.double polyshape(mus_any gen, cython.double index=1.0, cython.double fm=0.0):
static PyObject *__pyx_pw_8pysndlib_3clm_195polyshape(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static double __pyx_f_8pysndlib_3clm_polyshape(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_8pysndlib_3clm_polyshape *__pyx_optional_args) {
double __pyx_v_index = ((double)1.0);
double __pyx_v_fm = ((double)0.0);
double __pyx_r;
if (__pyx_optional_args) {
if (__pyx_optional_args->__pyx_n > 0) {
__pyx_v_index = __pyx_optional_args->index;
if (__pyx_optional_args->__pyx_n > 1) {
__pyx_v_fm = __pyx_optional_args->fm;
}
}
}
/* … */
/* function exit code */
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_195polyshape(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_194polyshape, "\n next sample of polynomial-based waveshaper.\n \n :param gen: polyshape gen\n :param index: fm index\n :param fm: fm input\n :rtype: float\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_195polyshape = {"polyshape", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_195polyshape, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_194polyshape};
static PyObject *__pyx_pw_8pysndlib_3clm_195polyshape(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = 0;
double __pyx_v_index;
double __pyx_v_fm;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("polyshape (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gen,&__pyx_n_s_index,&__pyx_n_s_fm,0};
PyObject* values[3] = {0,0,0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_gen)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2444, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_index);
if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2444, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 2:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_fm);
if (value) { values[2] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2444, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "polyshape") < 0)) __PYX_ERR(0, 2444, __pyx_L3_error)
}
} else {
switch (__pyx_nargs) {
case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
break;
default: goto __pyx_L5_argtuple_error;
}
}
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)values[0]);
if (values[1]) {
__pyx_v_index = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_index == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2444, __pyx_L3_error)
} else {
__pyx_v_index = ((double)1.0);
}
if (values[2]) {
__pyx_v_fm = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_fm == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2444, __pyx_L3_error)
} else {
__pyx_v_fm = ((double)0.0);
}
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("polyshape", 0, 1, 3, __pyx_nargs); __PYX_ERR(0, 2444, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.polyshape", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gen), __pyx_ptype_8pysndlib_3clm_mus_any, 1, "gen", 0))) __PYX_ERR(0, 2444, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_194polyshape(__pyx_self, __pyx_v_gen, __pyx_v_index, __pyx_v_fm);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_194polyshape(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, double __pyx_v_index, double __pyx_v_fm) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_2.__pyx_n = 2;
__pyx_t_2.index = __pyx_v_index;
__pyx_t_2.fm = __pyx_v_fm;
__pyx_t_1 = __pyx_f_8pysndlib_3clm_polyshape(__pyx_v_gen, 0, &__pyx_t_2); if (unlikely(__pyx_t_1 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2444, __pyx_L1_error)
__pyx_t_3 = PyFloat_FromDouble(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2444, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__pyx_r = __pyx_t_3;
__pyx_t_3 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_3);
__Pyx_AddTraceback("pysndlib.clm.polyshape", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_tuple__312 = PyTuple_Pack(3, __pyx_n_s_gen, __pyx_n_s_index, __pyx_n_s_fm); if (unlikely(!__pyx_tuple__312)) __PYX_ERR(0, 2444, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__312);
__Pyx_GIVEREF(__pyx_tuple__312);
__pyx_codeobj__313 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__312, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_polyshape, 2444, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__313)) __PYX_ERR(0, 2444, __pyx_L1_error)
/* … */
__pyx_t_43 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_195polyshape, 0, __pyx_n_s_polyshape, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__313)); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 2444, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
__Pyx_CyFunction_SetDefaultsTuple(__pyx_t_43, __pyx_tuple__314);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_polyshape, __pyx_t_43) < 0) __PYX_ERR(0, 2444, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
__pyx_tuple__314 = PyTuple_Pack(2, __pyx_float_1_0, __pyx_float_0_0); if (unlikely(!__pyx_tuple__314)) __PYX_ERR(0, 2444, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__314);
__Pyx_GIVEREF(__pyx_tuple__314);
2445: """
2446: next sample of polynomial-based waveshaper.
2447:
2448: :param gen: polyshape gen
2449: :param index: fm index
2450: :param fm: fm input
2451: :rtype: float
2452: """
+2453: if fm:
__pyx_t_1 = (__pyx_v_fm != 0);
if (__pyx_t_1) {
/* … */
}
+2454: return cclm.mus_polyshape(gen._ptr, index, fm)
__pyx_r = mus_polyshape(__pyx_v_gen->_ptr, __pyx_v_index, __pyx_v_fm);
goto __pyx_L0;
2455: else:
+2456: return cclm.mus_polyshape_unmodulated(gen._ptr, index)
/*else*/ {
__pyx_r = mus_polyshape_unmodulated(__pyx_v_gen->_ptr, __pyx_v_index);
goto __pyx_L0;
}
2457:
+2458: cpdef cython.double polyshape_unmodulated(mus_any gen, cython.double index=1.0):
static PyObject *__pyx_pw_8pysndlib_3clm_197polyshape_unmodulated(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static double __pyx_f_8pysndlib_3clm_polyshape_unmodulated(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_8pysndlib_3clm_polyshape_unmodulated *__pyx_optional_args) {
double __pyx_v_index = ((double)1.0);
double __pyx_r;
if (__pyx_optional_args) {
if (__pyx_optional_args->__pyx_n > 0) {
__pyx_v_index = __pyx_optional_args->index;
}
}
/* … */
/* function exit code */
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_197polyshape_unmodulated(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_196polyshape_unmodulated, "\n next sample of polynomial-based waveshaper. unmodulated\n \n :param gen: polyshape gen\n :param index: fm index\n :rtype: float\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_197polyshape_unmodulated = {"polyshape_unmodulated", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_197polyshape_unmodulated, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_196polyshape_unmodulated};
static PyObject *__pyx_pw_8pysndlib_3clm_197polyshape_unmodulated(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = 0;
double __pyx_v_index;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("polyshape_unmodulated (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gen,&__pyx_n_s_index,0};
PyObject* values[2] = {0,0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_gen)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2458, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_index);
if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2458, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "polyshape_unmodulated") < 0)) __PYX_ERR(0, 2458, __pyx_L3_error)
}
} else {
switch (__pyx_nargs) {
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
break;
default: goto __pyx_L5_argtuple_error;
}
}
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)values[0]);
if (values[1]) {
__pyx_v_index = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_index == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2458, __pyx_L3_error)
} else {
__pyx_v_index = ((double)1.0);
}
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("polyshape_unmodulated", 0, 1, 2, __pyx_nargs); __PYX_ERR(0, 2458, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.polyshape_unmodulated", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gen), __pyx_ptype_8pysndlib_3clm_mus_any, 1, "gen", 0))) __PYX_ERR(0, 2458, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_196polyshape_unmodulated(__pyx_self, __pyx_v_gen, __pyx_v_index);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_196polyshape_unmodulated(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, double __pyx_v_index) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_2.__pyx_n = 1;
__pyx_t_2.index = __pyx_v_index;
__pyx_t_1 = __pyx_f_8pysndlib_3clm_polyshape_unmodulated(__pyx_v_gen, 0, &__pyx_t_2); if (unlikely(__pyx_t_1 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2458, __pyx_L1_error)
__pyx_t_3 = PyFloat_FromDouble(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2458, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__pyx_r = __pyx_t_3;
__pyx_t_3 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_3);
__Pyx_AddTraceback("pysndlib.clm.polyshape_unmodulated", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_tuple__315 = PyTuple_Pack(2, __pyx_n_s_gen, __pyx_n_s_index); if (unlikely(!__pyx_tuple__315)) __PYX_ERR(0, 2458, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__315);
__Pyx_GIVEREF(__pyx_tuple__315);
__pyx_codeobj__316 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__315, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_polyshape_unmodulated, 2458, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__316)) __PYX_ERR(0, 2458, __pyx_L1_error)
/* … */
__pyx_t_43 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_197polyshape_unmodulated, 0, __pyx_n_s_polyshape_unmodulated, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__316)); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 2458, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
__Pyx_CyFunction_SetDefaultsTuple(__pyx_t_43, __pyx_tuple__317);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_polyshape_unmodulated, __pyx_t_43) < 0) __PYX_ERR(0, 2458, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
__pyx_tuple__317 = PyTuple_Pack(1, __pyx_float_1_0); if (unlikely(!__pyx_tuple__317)) __PYX_ERR(0, 2458, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__317);
__Pyx_GIVEREF(__pyx_tuple__317);
2459: """
2460: next sample of polynomial-based waveshaper. unmodulated
2461:
2462: :param gen: polyshape gen
2463: :param index: fm index
2464: :rtype: float
2465: """
+2466: return cclm.mus_polyshape_unmodulated(gen._ptr, index)
__pyx_r = mus_polyshape_unmodulated(__pyx_v_gen->_ptr, __pyx_v_index); goto __pyx_L0;
2467:
2468:
+2469: cpdef bint is_polyshape(mus_any gen):
static PyObject *__pyx_pw_8pysndlib_3clm_199is_polyshape(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static int __pyx_f_8pysndlib_3clm_is_polyshape(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, CYTHON_UNUSED int __pyx_skip_dispatch) {
int __pyx_r;
/* … */
/* function exit code */
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_199is_polyshape(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_198is_polyshape, "\n returns True if gen is a polyshape.\n \n :param gen: gen\n :rtype: bool\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_199is_polyshape = {"is_polyshape", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_199is_polyshape, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_198is_polyshape};
static PyObject *__pyx_pw_8pysndlib_3clm_199is_polyshape(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("is_polyshape (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gen,0};
PyObject* values[1] = {0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_gen)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2469, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "is_polyshape") < 0)) __PYX_ERR(0, 2469, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 1)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
}
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)values[0]);
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("is_polyshape", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 2469, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.is_polyshape", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gen), __pyx_ptype_8pysndlib_3clm_mus_any, 1, "gen", 0))) __PYX_ERR(0, 2469, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_198is_polyshape(__pyx_self, __pyx_v_gen);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_198is_polyshape(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8pysndlib_3clm_is_polyshape(__pyx_v_gen, 0); if (unlikely(__pyx_t_1 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2469, __pyx_L1_error)
__pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2469, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("pysndlib.clm.is_polyshape", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_43 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_199is_polyshape, 0, __pyx_n_s_is_polyshape, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__318)); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 2469, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_is_polyshape, __pyx_t_43) < 0) __PYX_ERR(0, 2469, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
/* … */
__pyx_codeobj__318 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__56, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_is_polyshape, 2469, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__318)) __PYX_ERR(0, 2469, __pyx_L1_error)
2470: """
2471: returns True if gen is a polyshape.
2472:
2473: :param gen: gen
2474: :rtype: bool
2475: """
+2476: return cclm.mus_is_polyshape(gen._ptr)
__pyx_r = mus_is_polyshape(__pyx_v_gen->_ptr); goto __pyx_L0;
2477:
2478:
2479: # ---------------- triangle-wave ---------------- #
+2480: cpdef mus_any make_triangle_wave(cython.double frequency, cython.double amplitude=1.0, cython.double phase=0.0):
static PyObject *__pyx_pw_8pysndlib_3clm_201make_triangle_wave(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_f_8pysndlib_3clm_make_triangle_wave(double __pyx_v_frequency, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_8pysndlib_3clm_make_triangle_wave *__pyx_optional_args) {
double __pyx_v_amplitude = ((double)1.0);
double __pyx_v_phase = ((double)0.0);
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_r = NULL;
if (__pyx_optional_args) {
if (__pyx_optional_args->__pyx_n > 0) {
__pyx_v_amplitude = __pyx_optional_args->amplitude;
if (__pyx_optional_args->__pyx_n > 1) {
__pyx_v_phase = __pyx_optional_args->phase;
}
}
}
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_AddTraceback("pysndlib.clm.make_triangle_wave", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XGIVEREF((PyObject *)__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_201make_triangle_wave(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_200make_triangle_wave, "\n return a new triangle_wave generator.\n \n :param frequency: frequency of generator\n :param amplitude: amplitude of generator\n :param phase: initial phase\n :return: triangle_wave gen\n :rtype: mus_any\n \n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_201make_triangle_wave = {"make_triangle_wave", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_201make_triangle_wave, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_200make_triangle_wave};
static PyObject *__pyx_pw_8pysndlib_3clm_201make_triangle_wave(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
double __pyx_v_frequency;
double __pyx_v_amplitude;
double __pyx_v_phase;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("make_triangle_wave (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_frequency,&__pyx_n_s_amplitude,&__pyx_n_s_phase,0};
PyObject* values[3] = {0,0,0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_frequency)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2480, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_amplitude);
if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2480, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 2:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_phase);
if (value) { values[2] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2480, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "make_triangle_wave") < 0)) __PYX_ERR(0, 2480, __pyx_L3_error)
}
} else {
switch (__pyx_nargs) {
case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
break;
default: goto __pyx_L5_argtuple_error;
}
}
__pyx_v_frequency = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_frequency == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2480, __pyx_L3_error)
if (values[1]) {
__pyx_v_amplitude = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_amplitude == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2480, __pyx_L3_error)
} else {
__pyx_v_amplitude = ((double)1.0);
}
if (values[2]) {
__pyx_v_phase = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_phase == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2480, __pyx_L3_error)
} else {
__pyx_v_phase = ((double)0.0);
}
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("make_triangle_wave", 0, 1, 3, __pyx_nargs); __PYX_ERR(0, 2480, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.make_triangle_wave", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_8pysndlib_3clm_200make_triangle_wave(__pyx_self, __pyx_v_frequency, __pyx_v_amplitude, __pyx_v_phase);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_200make_triangle_wave(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_frequency, double __pyx_v_amplitude, double __pyx_v_phase) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_2.__pyx_n = 2;
__pyx_t_2.amplitude = __pyx_v_amplitude;
__pyx_t_2.phase = __pyx_v_phase;
__pyx_t_1 = ((PyObject *)__pyx_f_8pysndlib_3clm_make_triangle_wave(__pyx_v_frequency, 0, &__pyx_t_2)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2480, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("pysndlib.clm.make_triangle_wave", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_tuple__319 = PyTuple_Pack(3, __pyx_n_s_frequency, __pyx_n_s_amplitude, __pyx_n_s_phase); if (unlikely(!__pyx_tuple__319)) __PYX_ERR(0, 2480, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__319);
__Pyx_GIVEREF(__pyx_tuple__319);
__pyx_codeobj__320 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__319, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_make_triangle_wave, 2480, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__320)) __PYX_ERR(0, 2480, __pyx_L1_error)
/* … */
__pyx_t_43 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_201make_triangle_wave, 0, __pyx_n_s_make_triangle_wave, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__320)); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 2480, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
__Pyx_CyFunction_SetDefaultsTuple(__pyx_t_43, __pyx_tuple__321);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_make_triangle_wave, __pyx_t_43) < 0) __PYX_ERR(0, 2480, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
__pyx_tuple__321 = PyTuple_Pack(2, __pyx_float_1_0, __pyx_float_0_0); if (unlikely(!__pyx_tuple__321)) __PYX_ERR(0, 2480, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__321);
__Pyx_GIVEREF(__pyx_tuple__321);
/* … */
struct __pyx_opt_args_8pysndlib_3clm_make_triangle_wave {
int __pyx_n;
double amplitude;
double phase;
};
2481: """
2482: return a new triangle_wave generator.
2483:
2484: :param frequency: frequency of generator
2485: :param amplitude: amplitude of generator
2486: :param phase: initial phase
2487: :return: triangle_wave gen
2488: :rtype: mus_any
2489:
2490: """
+2491: check_range('frequency', frequency, 0.0, get_srate() / 2)
__pyx_t_1 = PyFloat_FromDouble(__pyx_v_frequency); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2491, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __pyx_f_8pysndlib_3clm_get_srate(0); if (unlikely(__pyx_t_2 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2491, __pyx_L1_error) __pyx_t_3 = PyFloat_FromDouble((__pyx_t_2 / 2.0)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2491, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_5.__pyx_n = 2; __pyx_t_5.low = __pyx_float_0_0; __pyx_t_5.high = __pyx_t_3; __pyx_t_4 = __pyx_f_8pysndlib_3clm_check_range(__pyx_n_s_frequency, __pyx_t_1, 0, &__pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2491, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
2492:
+2493: return mus_any.from_ptr(cclm.mus_make_triangle_wave(frequency, amplitude, phase))
__Pyx_XDECREF((PyObject *)__pyx_r); __pyx_t_4 = ((PyObject *)__pyx_vtabptr_8pysndlib_3clm_mus_any->from_ptr(mus_make_triangle_wave(__pyx_v_frequency, __pyx_v_amplitude, __pyx_v_phase), NULL)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2493, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_r = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_t_4); __pyx_t_4 = 0; goto __pyx_L0;
2494:
+2495: cpdef cython.double triangle_wave(mus_any gen, cython.double fm=0.0):
static PyObject *__pyx_pw_8pysndlib_3clm_203triangle_wave(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static double __pyx_f_8pysndlib_3clm_triangle_wave(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_8pysndlib_3clm_triangle_wave *__pyx_optional_args) {
double __pyx_v_fm = ((double)0.0);
double __pyx_r;
if (__pyx_optional_args) {
if (__pyx_optional_args->__pyx_n > 0) {
__pyx_v_fm = __pyx_optional_args->fm;
}
}
/* … */
/* function exit code */
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_203triangle_wave(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_202triangle_wave, "\n next triangle wave sample from generator. \n \n :param gen: polyshape gen\n :param fm: fm input\n :rtype: float\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_203triangle_wave = {"triangle_wave", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_203triangle_wave, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_202triangle_wave};
static PyObject *__pyx_pw_8pysndlib_3clm_203triangle_wave(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = 0;
double __pyx_v_fm;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("triangle_wave (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gen,&__pyx_n_s_fm,0};
PyObject* values[2] = {0,0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_gen)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2495, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_fm);
if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2495, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "triangle_wave") < 0)) __PYX_ERR(0, 2495, __pyx_L3_error)
}
} else {
switch (__pyx_nargs) {
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
break;
default: goto __pyx_L5_argtuple_error;
}
}
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)values[0]);
if (values[1]) {
__pyx_v_fm = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_fm == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2495, __pyx_L3_error)
} else {
__pyx_v_fm = ((double)0.0);
}
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("triangle_wave", 0, 1, 2, __pyx_nargs); __PYX_ERR(0, 2495, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.triangle_wave", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gen), __pyx_ptype_8pysndlib_3clm_mus_any, 1, "gen", 0))) __PYX_ERR(0, 2495, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_202triangle_wave(__pyx_self, __pyx_v_gen, __pyx_v_fm);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_202triangle_wave(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, double __pyx_v_fm) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_2.__pyx_n = 1;
__pyx_t_2.fm = __pyx_v_fm;
__pyx_t_1 = __pyx_f_8pysndlib_3clm_triangle_wave(__pyx_v_gen, 0, &__pyx_t_2); if (unlikely(__pyx_t_1 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2495, __pyx_L1_error)
__pyx_t_3 = PyFloat_FromDouble(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2495, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__pyx_r = __pyx_t_3;
__pyx_t_3 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_3);
__Pyx_AddTraceback("pysndlib.clm.triangle_wave", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_codeobj__322 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__291, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_triangle_wave, 2495, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__322)) __PYX_ERR(0, 2495, __pyx_L1_error)
/* … */
__pyx_t_43 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_203triangle_wave, 0, __pyx_n_s_triangle_wave, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__322)); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 2495, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
__Pyx_CyFunction_SetDefaultsTuple(__pyx_t_43, __pyx_tuple__323);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_triangle_wave, __pyx_t_43) < 0) __PYX_ERR(0, 2495, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
__pyx_tuple__323 = PyTuple_Pack(1, __pyx_float_0_0); if (unlikely(!__pyx_tuple__323)) __PYX_ERR(0, 2495, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__323);
__Pyx_GIVEREF(__pyx_tuple__323);
2496: """
2497: next triangle wave sample from generator.
2498:
2499: :param gen: polyshape gen
2500: :param fm: fm input
2501: :rtype: float
2502: """
+2503: return cclm.mus_triangle_wave(gen._ptr, fm)
__pyx_r = mus_triangle_wave(__pyx_v_gen->_ptr, __pyx_v_fm); goto __pyx_L0;
2504:
2505:
+2506: cpdef cython.double triangle_wave_unmodulated(mus_any gen):
static PyObject *__pyx_pw_8pysndlib_3clm_205triangle_wave_unmodulated(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static double __pyx_f_8pysndlib_3clm_triangle_wave_unmodulated(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, CYTHON_UNUSED int __pyx_skip_dispatch) {
double __pyx_r;
/* … */
/* function exit code */
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_205triangle_wave_unmodulated(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_204triangle_wave_unmodulated, "\n next triangle wave sample from generator. unmodulated\n \n :param gen: polyshape gen\n :rtype: float\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_205triangle_wave_unmodulated = {"triangle_wave_unmodulated", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_205triangle_wave_unmodulated, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_204triangle_wave_unmodulated};
static PyObject *__pyx_pw_8pysndlib_3clm_205triangle_wave_unmodulated(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("triangle_wave_unmodulated (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gen,0};
PyObject* values[1] = {0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_gen)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2506, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "triangle_wave_unmodulated") < 0)) __PYX_ERR(0, 2506, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 1)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
}
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)values[0]);
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("triangle_wave_unmodulated", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 2506, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.triangle_wave_unmodulated", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gen), __pyx_ptype_8pysndlib_3clm_mus_any, 1, "gen", 0))) __PYX_ERR(0, 2506, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_204triangle_wave_unmodulated(__pyx_self, __pyx_v_gen);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_204triangle_wave_unmodulated(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8pysndlib_3clm_triangle_wave_unmodulated(__pyx_v_gen, 0); if (unlikely(__pyx_t_1 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2506, __pyx_L1_error)
__pyx_t_2 = PyFloat_FromDouble(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2506, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("pysndlib.clm.triangle_wave_unmodulated", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_43 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_205triangle_wave_unmodulated, 0, __pyx_n_s_triangle_wave_unmodulated, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__324)); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 2506, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_triangle_wave_unmodulated, __pyx_t_43) < 0) __PYX_ERR(0, 2506, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
/* … */
__pyx_codeobj__324 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__56, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_triangle_wave_unmodulated, 2506, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__324)) __PYX_ERR(0, 2506, __pyx_L1_error)
2507: """
2508: next triangle wave sample from generator. unmodulated
2509:
2510: :param gen: polyshape gen
2511: :rtype: float
2512: """
+2513: return cclm.mus_triangle_wave_unmodulated(gen._ptr)
__pyx_r = mus_triangle_wave_unmodulated(__pyx_v_gen->_ptr); goto __pyx_L0;
2514:
+2515: cpdef bint is_triangle_wave(mus_any gen):
static PyObject *__pyx_pw_8pysndlib_3clm_207is_triangle_wave(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static int __pyx_f_8pysndlib_3clm_is_triangle_wave(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, CYTHON_UNUSED int __pyx_skip_dispatch) {
int __pyx_r;
/* … */
/* function exit code */
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_207is_triangle_wave(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_206is_triangle_wave, "\n returns True if gen is a triangle_wave.\n \n :param gen: gen\n :rtype: bool\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_207is_triangle_wave = {"is_triangle_wave", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_207is_triangle_wave, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_206is_triangle_wave};
static PyObject *__pyx_pw_8pysndlib_3clm_207is_triangle_wave(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("is_triangle_wave (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gen,0};
PyObject* values[1] = {0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_gen)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2515, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "is_triangle_wave") < 0)) __PYX_ERR(0, 2515, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 1)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
}
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)values[0]);
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("is_triangle_wave", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 2515, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.is_triangle_wave", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gen), __pyx_ptype_8pysndlib_3clm_mus_any, 1, "gen", 0))) __PYX_ERR(0, 2515, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_206is_triangle_wave(__pyx_self, __pyx_v_gen);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_206is_triangle_wave(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8pysndlib_3clm_is_triangle_wave(__pyx_v_gen, 0); if (unlikely(__pyx_t_1 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2515, __pyx_L1_error)
__pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2515, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("pysndlib.clm.is_triangle_wave", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_43 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_207is_triangle_wave, 0, __pyx_n_s_is_triangle_wave, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__325)); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 2515, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_is_triangle_wave, __pyx_t_43) < 0) __PYX_ERR(0, 2515, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
/* … */
__pyx_codeobj__325 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__56, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_is_triangle_wave, 2515, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__325)) __PYX_ERR(0, 2515, __pyx_L1_error)
2516: """
2517: returns True if gen is a triangle_wave.
2518:
2519: :param gen: gen
2520: :rtype: bool
2521: """
+2522: return cclm.mus_is_triangle_wave(gen._ptr)
__pyx_r = mus_is_triangle_wave(__pyx_v_gen->_ptr); goto __pyx_L0;
2523:
2524: # ---------------- square-wave ---------------- #
+2525: cpdef mus_any make_square_wave(cython.double frequency , cython.double amplitude=1.0, cython.double phase=0.0):
static PyObject *__pyx_pw_8pysndlib_3clm_209make_square_wave(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_f_8pysndlib_3clm_make_square_wave(double __pyx_v_frequency, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_8pysndlib_3clm_make_square_wave *__pyx_optional_args) {
double __pyx_v_amplitude = ((double)1.0);
double __pyx_v_phase = ((double)0.0);
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_r = NULL;
if (__pyx_optional_args) {
if (__pyx_optional_args->__pyx_n > 0) {
__pyx_v_amplitude = __pyx_optional_args->amplitude;
if (__pyx_optional_args->__pyx_n > 1) {
__pyx_v_phase = __pyx_optional_args->phase;
}
}
}
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_AddTraceback("pysndlib.clm.make_square_wave", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XGIVEREF((PyObject *)__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_209make_square_wave(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_208make_square_wave, "\n return a new square_wave generator.\n \n :param frequency: frequency of generator\n :param amplitude: amplitude of generator\n :param phase: initial phase\n :return: square_wave gen\n :rtype: mus_any\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_209make_square_wave = {"make_square_wave", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_209make_square_wave, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_208make_square_wave};
static PyObject *__pyx_pw_8pysndlib_3clm_209make_square_wave(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
double __pyx_v_frequency;
double __pyx_v_amplitude;
double __pyx_v_phase;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("make_square_wave (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_frequency,&__pyx_n_s_amplitude,&__pyx_n_s_phase,0};
PyObject* values[3] = {0,0,0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_frequency)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2525, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_amplitude);
if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2525, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 2:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_phase);
if (value) { values[2] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2525, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "make_square_wave") < 0)) __PYX_ERR(0, 2525, __pyx_L3_error)
}
} else {
switch (__pyx_nargs) {
case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
break;
default: goto __pyx_L5_argtuple_error;
}
}
__pyx_v_frequency = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_frequency == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2525, __pyx_L3_error)
if (values[1]) {
__pyx_v_amplitude = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_amplitude == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2525, __pyx_L3_error)
} else {
__pyx_v_amplitude = ((double)1.0);
}
if (values[2]) {
__pyx_v_phase = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_phase == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2525, __pyx_L3_error)
} else {
__pyx_v_phase = ((double)0.0);
}
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("make_square_wave", 0, 1, 3, __pyx_nargs); __PYX_ERR(0, 2525, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.make_square_wave", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_8pysndlib_3clm_208make_square_wave(__pyx_self, __pyx_v_frequency, __pyx_v_amplitude, __pyx_v_phase);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_208make_square_wave(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_frequency, double __pyx_v_amplitude, double __pyx_v_phase) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_2.__pyx_n = 2;
__pyx_t_2.amplitude = __pyx_v_amplitude;
__pyx_t_2.phase = __pyx_v_phase;
__pyx_t_1 = ((PyObject *)__pyx_f_8pysndlib_3clm_make_square_wave(__pyx_v_frequency, 0, &__pyx_t_2)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2525, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("pysndlib.clm.make_square_wave", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_codeobj__326 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__319, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_make_square_wave, 2525, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__326)) __PYX_ERR(0, 2525, __pyx_L1_error)
/* … */
__pyx_t_43 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_209make_square_wave, 0, __pyx_n_s_make_square_wave, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__326)); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 2525, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
__Pyx_CyFunction_SetDefaultsTuple(__pyx_t_43, __pyx_tuple__327);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_make_square_wave, __pyx_t_43) < 0) __PYX_ERR(0, 2525, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
__pyx_tuple__327 = PyTuple_Pack(2, __pyx_float_1_0, __pyx_float_0_0); if (unlikely(!__pyx_tuple__327)) __PYX_ERR(0, 2525, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__327);
__Pyx_GIVEREF(__pyx_tuple__327);
/* … */
struct __pyx_opt_args_8pysndlib_3clm_make_square_wave {
int __pyx_n;
double amplitude;
double phase;
};
2526: """
2527: return a new square_wave generator.
2528:
2529: :param frequency: frequency of generator
2530: :param amplitude: amplitude of generator
2531: :param phase: initial phase
2532: :return: square_wave gen
2533: :rtype: mus_any
2534: """
+2535: check_range('frequency', frequency, 0.0, get_srate() / 2)
__pyx_t_1 = PyFloat_FromDouble(__pyx_v_frequency); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2535, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __pyx_f_8pysndlib_3clm_get_srate(0); if (unlikely(__pyx_t_2 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2535, __pyx_L1_error) __pyx_t_3 = PyFloat_FromDouble((__pyx_t_2 / 2.0)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2535, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_5.__pyx_n = 2; __pyx_t_5.low = __pyx_float_0_0; __pyx_t_5.high = __pyx_t_3; __pyx_t_4 = __pyx_f_8pysndlib_3clm_check_range(__pyx_n_s_frequency, __pyx_t_1, 0, &__pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2535, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
2536:
+2537: return mus_any.from_ptr(cclm.mus_make_square_wave(frequency, amplitude, phase))
__Pyx_XDECREF((PyObject *)__pyx_r); __pyx_t_4 = ((PyObject *)__pyx_vtabptr_8pysndlib_3clm_mus_any->from_ptr(mus_make_square_wave(__pyx_v_frequency, __pyx_v_amplitude, __pyx_v_phase), NULL)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2537, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_r = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_t_4); __pyx_t_4 = 0; goto __pyx_L0;
2538:
+2539: cpdef cython.double square_wave(mus_any gen, cython.double fm=0.0):
static PyObject *__pyx_pw_8pysndlib_3clm_211square_wave(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static double __pyx_f_8pysndlib_3clm_square_wave(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_8pysndlib_3clm_square_wave *__pyx_optional_args) {
double __pyx_v_fm = ((double)0.0);
double __pyx_r;
if (__pyx_optional_args) {
if (__pyx_optional_args->__pyx_n > 0) {
__pyx_v_fm = __pyx_optional_args->fm;
}
}
/* … */
/* function exit code */
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_211square_wave(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_210square_wave, "\n next square wave sample from generator.\n \n :param gen: polyshape gen\n :param fm: fm input\n :rtype: float\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_211square_wave = {"square_wave", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_211square_wave, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_210square_wave};
static PyObject *__pyx_pw_8pysndlib_3clm_211square_wave(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = 0;
double __pyx_v_fm;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("square_wave (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gen,&__pyx_n_s_fm,0};
PyObject* values[2] = {0,0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_gen)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2539, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_fm);
if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2539, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "square_wave") < 0)) __PYX_ERR(0, 2539, __pyx_L3_error)
}
} else {
switch (__pyx_nargs) {
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
break;
default: goto __pyx_L5_argtuple_error;
}
}
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)values[0]);
if (values[1]) {
__pyx_v_fm = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_fm == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2539, __pyx_L3_error)
} else {
__pyx_v_fm = ((double)0.0);
}
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("square_wave", 0, 1, 2, __pyx_nargs); __PYX_ERR(0, 2539, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.square_wave", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gen), __pyx_ptype_8pysndlib_3clm_mus_any, 1, "gen", 0))) __PYX_ERR(0, 2539, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_210square_wave(__pyx_self, __pyx_v_gen, __pyx_v_fm);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_210square_wave(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, double __pyx_v_fm) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_2.__pyx_n = 1;
__pyx_t_2.fm = __pyx_v_fm;
__pyx_t_1 = __pyx_f_8pysndlib_3clm_square_wave(__pyx_v_gen, 0, &__pyx_t_2); if (unlikely(__pyx_t_1 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2539, __pyx_L1_error)
__pyx_t_3 = PyFloat_FromDouble(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2539, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__pyx_r = __pyx_t_3;
__pyx_t_3 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_3);
__Pyx_AddTraceback("pysndlib.clm.square_wave", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_codeobj__328 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__291, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_square_wave, 2539, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__328)) __PYX_ERR(0, 2539, __pyx_L1_error)
/* … */
__pyx_t_43 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_211square_wave, 0, __pyx_n_s_square_wave, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__328)); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 2539, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
__Pyx_CyFunction_SetDefaultsTuple(__pyx_t_43, __pyx_tuple__329);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_square_wave, __pyx_t_43) < 0) __PYX_ERR(0, 2539, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
__pyx_tuple__329 = PyTuple_Pack(1, __pyx_float_0_0); if (unlikely(!__pyx_tuple__329)) __PYX_ERR(0, 2539, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__329);
__Pyx_GIVEREF(__pyx_tuple__329);
2540: """
2541: next square wave sample from generator.
2542:
2543: :param gen: polyshape gen
2544: :param fm: fm input
2545: :rtype: float
2546: """
+2547: return cclm.mus_square_wave(gen._ptr, fm)
__pyx_r = mus_square_wave(__pyx_v_gen->_ptr, __pyx_v_fm); goto __pyx_L0;
2548:
+2549: cpdef bint is_square_wave(mus_any gen):
static PyObject *__pyx_pw_8pysndlib_3clm_213is_square_wave(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static int __pyx_f_8pysndlib_3clm_is_square_wave(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, CYTHON_UNUSED int __pyx_skip_dispatch) {
int __pyx_r;
/* … */
/* function exit code */
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_213is_square_wave(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_212is_square_wave, "\n returns True if gen is a square_wave.\n \n :param gen: gen\n :rtype: bool\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_213is_square_wave = {"is_square_wave", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_213is_square_wave, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_212is_square_wave};
static PyObject *__pyx_pw_8pysndlib_3clm_213is_square_wave(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("is_square_wave (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gen,0};
PyObject* values[1] = {0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_gen)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2549, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "is_square_wave") < 0)) __PYX_ERR(0, 2549, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 1)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
}
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)values[0]);
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("is_square_wave", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 2549, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.is_square_wave", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gen), __pyx_ptype_8pysndlib_3clm_mus_any, 1, "gen", 0))) __PYX_ERR(0, 2549, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_212is_square_wave(__pyx_self, __pyx_v_gen);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_212is_square_wave(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8pysndlib_3clm_is_square_wave(__pyx_v_gen, 0); if (unlikely(__pyx_t_1 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2549, __pyx_L1_error)
__pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2549, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("pysndlib.clm.is_square_wave", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_43 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_213is_square_wave, 0, __pyx_n_s_is_square_wave, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__330)); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 2549, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_is_square_wave, __pyx_t_43) < 0) __PYX_ERR(0, 2549, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
/* … */
__pyx_codeobj__330 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__56, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_is_square_wave, 2549, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__330)) __PYX_ERR(0, 2549, __pyx_L1_error)
2550: """
2551: returns True if gen is a square_wave.
2552:
2553: :param gen: gen
2554: :rtype: bool
2555: """
+2556: return cclm.mus_is_square_wave(gen._ptr)
__pyx_r = mus_is_square_wave(__pyx_v_gen->_ptr); goto __pyx_L0;
2557:
2558: # ---------------- sawtooth-wave ---------------- #
+2559: cpdef mus_any make_sawtooth_wave(cython.double frequency, cython.double amplitude=1.0, cython.double phase=0.0):
static PyObject *__pyx_pw_8pysndlib_3clm_215make_sawtooth_wave(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_f_8pysndlib_3clm_make_sawtooth_wave(double __pyx_v_frequency, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_8pysndlib_3clm_make_sawtooth_wave *__pyx_optional_args) {
double __pyx_v_amplitude = ((double)1.0);
double __pyx_v_phase = ((double)0.0);
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_r = NULL;
if (__pyx_optional_args) {
if (__pyx_optional_args->__pyx_n > 0) {
__pyx_v_amplitude = __pyx_optional_args->amplitude;
if (__pyx_optional_args->__pyx_n > 1) {
__pyx_v_phase = __pyx_optional_args->phase;
}
}
}
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_AddTraceback("pysndlib.clm.make_sawtooth_wave", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XGIVEREF((PyObject *)__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_215make_sawtooth_wave(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_214make_sawtooth_wave, "\n return a new sawtooth_wave generator.\n \n :param frequency: frequency of generator\n :param amplitude: amplitude of generator\n :param phase: initial phase\n :return: sawtooth_wave gen\n :rtype: mus_any\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_215make_sawtooth_wave = {"make_sawtooth_wave", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_215make_sawtooth_wave, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_214make_sawtooth_wave};
static PyObject *__pyx_pw_8pysndlib_3clm_215make_sawtooth_wave(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
double __pyx_v_frequency;
double __pyx_v_amplitude;
double __pyx_v_phase;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("make_sawtooth_wave (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_frequency,&__pyx_n_s_amplitude,&__pyx_n_s_phase,0};
PyObject* values[3] = {0,0,0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_frequency)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2559, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_amplitude);
if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2559, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 2:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_phase);
if (value) { values[2] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2559, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "make_sawtooth_wave") < 0)) __PYX_ERR(0, 2559, __pyx_L3_error)
}
} else {
switch (__pyx_nargs) {
case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
break;
default: goto __pyx_L5_argtuple_error;
}
}
__pyx_v_frequency = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_frequency == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2559, __pyx_L3_error)
if (values[1]) {
__pyx_v_amplitude = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_amplitude == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2559, __pyx_L3_error)
} else {
__pyx_v_amplitude = ((double)1.0);
}
if (values[2]) {
__pyx_v_phase = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_phase == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2559, __pyx_L3_error)
} else {
__pyx_v_phase = ((double)0.0);
}
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("make_sawtooth_wave", 0, 1, 3, __pyx_nargs); __PYX_ERR(0, 2559, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.make_sawtooth_wave", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_8pysndlib_3clm_214make_sawtooth_wave(__pyx_self, __pyx_v_frequency, __pyx_v_amplitude, __pyx_v_phase);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_214make_sawtooth_wave(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_frequency, double __pyx_v_amplitude, double __pyx_v_phase) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_2.__pyx_n = 2;
__pyx_t_2.amplitude = __pyx_v_amplitude;
__pyx_t_2.phase = __pyx_v_phase;
__pyx_t_1 = ((PyObject *)__pyx_f_8pysndlib_3clm_make_sawtooth_wave(__pyx_v_frequency, 0, &__pyx_t_2)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2559, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("pysndlib.clm.make_sawtooth_wave", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_codeobj__331 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__319, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_make_sawtooth_wave, 2559, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__331)) __PYX_ERR(0, 2559, __pyx_L1_error)
/* … */
__pyx_t_43 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_215make_sawtooth_wave, 0, __pyx_n_s_make_sawtooth_wave, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__331)); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 2559, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
__Pyx_CyFunction_SetDefaultsTuple(__pyx_t_43, __pyx_tuple__332);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_make_sawtooth_wave, __pyx_t_43) < 0) __PYX_ERR(0, 2559, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
__pyx_tuple__332 = PyTuple_Pack(2, __pyx_float_1_0, __pyx_float_0_0); if (unlikely(!__pyx_tuple__332)) __PYX_ERR(0, 2559, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__332);
__Pyx_GIVEREF(__pyx_tuple__332);
/* … */
struct __pyx_opt_args_8pysndlib_3clm_make_sawtooth_wave {
int __pyx_n;
double amplitude;
double phase;
};
2560: """
2561: return a new sawtooth_wave generator.
2562:
2563: :param frequency: frequency of generator
2564: :param amplitude: amplitude of generator
2565: :param phase: initial phase
2566: :return: sawtooth_wave gen
2567: :rtype: mus_any
2568: """
2569:
+2570: check_range('frequency', frequency, 0.0, get_srate() / 2)
__pyx_t_1 = PyFloat_FromDouble(__pyx_v_frequency); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2570, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __pyx_f_8pysndlib_3clm_get_srate(0); if (unlikely(__pyx_t_2 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2570, __pyx_L1_error) __pyx_t_3 = PyFloat_FromDouble((__pyx_t_2 / 2.0)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2570, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_5.__pyx_n = 2; __pyx_t_5.low = __pyx_float_0_0; __pyx_t_5.high = __pyx_t_3; __pyx_t_4 = __pyx_f_8pysndlib_3clm_check_range(__pyx_n_s_frequency, __pyx_t_1, 0, &__pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2570, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
2571:
+2572: return mus_any.from_ptr(cclm.mus_make_sawtooth_wave(frequency, amplitude, phase))
__Pyx_XDECREF((PyObject *)__pyx_r); __pyx_t_4 = ((PyObject *)__pyx_vtabptr_8pysndlib_3clm_mus_any->from_ptr(mus_make_sawtooth_wave(__pyx_v_frequency, __pyx_v_amplitude, __pyx_v_phase), NULL)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2572, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_r = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_t_4); __pyx_t_4 = 0; goto __pyx_L0;
2573:
+2574: cpdef cython.double sawtooth_wave(mus_any gen, cython.double fm =0.0):
static PyObject *__pyx_pw_8pysndlib_3clm_217sawtooth_wave(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static double __pyx_f_8pysndlib_3clm_sawtooth_wave(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_8pysndlib_3clm_sawtooth_wave *__pyx_optional_args) {
double __pyx_v_fm = ((double)0.0);
double __pyx_r;
if (__pyx_optional_args) {
if (__pyx_optional_args->__pyx_n > 0) {
__pyx_v_fm = __pyx_optional_args->fm;
}
}
/* … */
/* function exit code */
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_217sawtooth_wave(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_216sawtooth_wave, "\n next sawtooth wave sample from generator.\n \n :param gen: polyshape gen\n :param fm: fm input\n :rtype: float\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_217sawtooth_wave = {"sawtooth_wave", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_217sawtooth_wave, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_216sawtooth_wave};
static PyObject *__pyx_pw_8pysndlib_3clm_217sawtooth_wave(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = 0;
double __pyx_v_fm;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("sawtooth_wave (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gen,&__pyx_n_s_fm,0};
PyObject* values[2] = {0,0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_gen)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2574, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_fm);
if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2574, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "sawtooth_wave") < 0)) __PYX_ERR(0, 2574, __pyx_L3_error)
}
} else {
switch (__pyx_nargs) {
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
break;
default: goto __pyx_L5_argtuple_error;
}
}
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)values[0]);
if (values[1]) {
__pyx_v_fm = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_fm == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2574, __pyx_L3_error)
} else {
__pyx_v_fm = ((double)0.0);
}
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("sawtooth_wave", 0, 1, 2, __pyx_nargs); __PYX_ERR(0, 2574, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.sawtooth_wave", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gen), __pyx_ptype_8pysndlib_3clm_mus_any, 1, "gen", 0))) __PYX_ERR(0, 2574, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_216sawtooth_wave(__pyx_self, __pyx_v_gen, __pyx_v_fm);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_216sawtooth_wave(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, double __pyx_v_fm) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_2.__pyx_n = 1;
__pyx_t_2.fm = __pyx_v_fm;
__pyx_t_1 = __pyx_f_8pysndlib_3clm_sawtooth_wave(__pyx_v_gen, 0, &__pyx_t_2); if (unlikely(__pyx_t_1 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2574, __pyx_L1_error)
__pyx_t_3 = PyFloat_FromDouble(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2574, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__pyx_r = __pyx_t_3;
__pyx_t_3 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_3);
__Pyx_AddTraceback("pysndlib.clm.sawtooth_wave", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_codeobj__333 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__291, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_sawtooth_wave, 2574, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__333)) __PYX_ERR(0, 2574, __pyx_L1_error)
/* … */
__pyx_t_43 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_217sawtooth_wave, 0, __pyx_n_s_sawtooth_wave, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__333)); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 2574, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
__Pyx_CyFunction_SetDefaultsTuple(__pyx_t_43, __pyx_tuple__334);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_sawtooth_wave, __pyx_t_43) < 0) __PYX_ERR(0, 2574, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
__pyx_tuple__334 = PyTuple_Pack(1, __pyx_float_0_0); if (unlikely(!__pyx_tuple__334)) __PYX_ERR(0, 2574, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__334);
__Pyx_GIVEREF(__pyx_tuple__334);
2575: """
2576: next sawtooth wave sample from generator.
2577:
2578: :param gen: polyshape gen
2579: :param fm: fm input
2580: :rtype: float
2581: """
+2582: return cclm.mus_sawtooth_wave(gen._ptr, fm)
__pyx_r = mus_sawtooth_wave(__pyx_v_gen->_ptr, __pyx_v_fm); goto __pyx_L0;
2583:
2584:
+2585: cpdef bint is_sawtooth_wave(mus_any gen):
static PyObject *__pyx_pw_8pysndlib_3clm_219is_sawtooth_wave(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static int __pyx_f_8pysndlib_3clm_is_sawtooth_wave(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, CYTHON_UNUSED int __pyx_skip_dispatch) {
int __pyx_r;
/* … */
/* function exit code */
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_219is_sawtooth_wave(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_218is_sawtooth_wave, "\n returns True if gen is a sawtooth_wave.\n \n :param gen: gen\n :rtype: bool\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_219is_sawtooth_wave = {"is_sawtooth_wave", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_219is_sawtooth_wave, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_218is_sawtooth_wave};
static PyObject *__pyx_pw_8pysndlib_3clm_219is_sawtooth_wave(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("is_sawtooth_wave (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gen,0};
PyObject* values[1] = {0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_gen)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2585, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "is_sawtooth_wave") < 0)) __PYX_ERR(0, 2585, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 1)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
}
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)values[0]);
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("is_sawtooth_wave", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 2585, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.is_sawtooth_wave", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gen), __pyx_ptype_8pysndlib_3clm_mus_any, 1, "gen", 0))) __PYX_ERR(0, 2585, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_218is_sawtooth_wave(__pyx_self, __pyx_v_gen);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_218is_sawtooth_wave(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8pysndlib_3clm_is_sawtooth_wave(__pyx_v_gen, 0); if (unlikely(__pyx_t_1 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2585, __pyx_L1_error)
__pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2585, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("pysndlib.clm.is_sawtooth_wave", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_43 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_219is_sawtooth_wave, 0, __pyx_n_s_is_sawtooth_wave, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__335)); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 2585, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_is_sawtooth_wave, __pyx_t_43) < 0) __PYX_ERR(0, 2585, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
/* … */
__pyx_codeobj__335 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__56, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_is_sawtooth_wave, 2585, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__335)) __PYX_ERR(0, 2585, __pyx_L1_error)
2586: """
2587: returns True if gen is a sawtooth_wave.
2588:
2589: :param gen: gen
2590: :rtype: bool
2591: """
+2592: return cclm.mus_is_sawtooth_wave(gen._ptr)
__pyx_r = mus_is_sawtooth_wave(__pyx_v_gen->_ptr); goto __pyx_L0;
2593:
2594: # ---------------- pulse-train ---------------- #
+2595: cpdef mus_any make_pulse_train(cython.double frequency=1.0, cython.double amplitude=1.0, cython.double phase=0.0):
static PyObject *__pyx_pw_8pysndlib_3clm_221make_pulse_train(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_f_8pysndlib_3clm_make_pulse_train(CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_8pysndlib_3clm_make_pulse_train *__pyx_optional_args) {
double __pyx_v_frequency = ((double)1.0);
double __pyx_v_amplitude = ((double)1.0);
double __pyx_v_phase = ((double)0.0);
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_r = NULL;
if (__pyx_optional_args) {
if (__pyx_optional_args->__pyx_n > 0) {
__pyx_v_frequency = __pyx_optional_args->frequency;
if (__pyx_optional_args->__pyx_n > 1) {
__pyx_v_amplitude = __pyx_optional_args->amplitude;
if (__pyx_optional_args->__pyx_n > 2) {
__pyx_v_phase = __pyx_optional_args->phase;
}
}
}
}
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_AddTraceback("pysndlib.clm.make_pulse_train", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XGIVEREF((PyObject *)__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_221make_pulse_train(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_220make_pulse_train, "\n return a new pulse_train generator. this produces a sequence of impulses.\n \n :param frequency: frequency of generator\n :param amplitude: amplitude of generator\n :param phase: initial phase\n :return: pulse_train gen\n :rtype: mus_any\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_221make_pulse_train = {"make_pulse_train", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_221make_pulse_train, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_220make_pulse_train};
static PyObject *__pyx_pw_8pysndlib_3clm_221make_pulse_train(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
double __pyx_v_frequency;
double __pyx_v_amplitude;
double __pyx_v_phase;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("make_pulse_train (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_frequency,&__pyx_n_s_amplitude,&__pyx_n_s_phase,0};
PyObject* values[3] = {0,0,0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_frequency);
if (value) { values[0] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2595, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 1:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_amplitude);
if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2595, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 2:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_phase);
if (value) { values[2] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2595, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "make_pulse_train") < 0)) __PYX_ERR(0, 2595, __pyx_L3_error)
}
} else {
switch (__pyx_nargs) {
case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
}
if (values[0]) {
__pyx_v_frequency = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_frequency == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2595, __pyx_L3_error)
} else {
__pyx_v_frequency = ((double)1.0);
}
if (values[1]) {
__pyx_v_amplitude = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_amplitude == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2595, __pyx_L3_error)
} else {
__pyx_v_amplitude = ((double)1.0);
}
if (values[2]) {
__pyx_v_phase = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_phase == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2595, __pyx_L3_error)
} else {
__pyx_v_phase = ((double)0.0);
}
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("make_pulse_train", 0, 0, 3, __pyx_nargs); __PYX_ERR(0, 2595, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.make_pulse_train", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_8pysndlib_3clm_220make_pulse_train(__pyx_self, __pyx_v_frequency, __pyx_v_amplitude, __pyx_v_phase);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_220make_pulse_train(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_frequency, double __pyx_v_amplitude, double __pyx_v_phase) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_2.__pyx_n = 3;
__pyx_t_2.frequency = __pyx_v_frequency;
__pyx_t_2.amplitude = __pyx_v_amplitude;
__pyx_t_2.phase = __pyx_v_phase;
__pyx_t_1 = ((PyObject *)__pyx_f_8pysndlib_3clm_make_pulse_train(0, &__pyx_t_2)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2595, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("pysndlib.clm.make_pulse_train", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_codeobj__336 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__319, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_make_pulse_train, 2595, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__336)) __PYX_ERR(0, 2595, __pyx_L1_error)
/* … */
__pyx_t_43 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_221make_pulse_train, 0, __pyx_n_s_make_pulse_train, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__336)); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 2595, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
__Pyx_CyFunction_SetDefaultsTuple(__pyx_t_43, __pyx_tuple__337);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_make_pulse_train, __pyx_t_43) < 0) __PYX_ERR(0, 2595, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
__pyx_tuple__337 = PyTuple_Pack(3, __pyx_float_1_0, __pyx_float_1_0, __pyx_float_0_0); if (unlikely(!__pyx_tuple__337)) __PYX_ERR(0, 2595, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__337);
__Pyx_GIVEREF(__pyx_tuple__337);
/* … */
struct __pyx_opt_args_8pysndlib_3clm_make_pulse_train {
int __pyx_n;
double frequency;
double amplitude;
double phase;
};
2596: """
2597: return a new pulse_train generator. this produces a sequence of impulses.
2598:
2599: :param frequency: frequency of generator
2600: :param amplitude: amplitude of generator
2601: :param phase: initial phase
2602: :return: pulse_train gen
2603: :rtype: mus_any
2604: """
2605:
+2606: check_range('frequency', frequency, 0.0, get_srate() / 2)
__pyx_t_1 = PyFloat_FromDouble(__pyx_v_frequency); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2606, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __pyx_f_8pysndlib_3clm_get_srate(0); if (unlikely(__pyx_t_2 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2606, __pyx_L1_error) __pyx_t_3 = PyFloat_FromDouble((__pyx_t_2 / 2.0)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2606, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_5.__pyx_n = 2; __pyx_t_5.low = __pyx_float_0_0; __pyx_t_5.high = __pyx_t_3; __pyx_t_4 = __pyx_f_8pysndlib_3clm_check_range(__pyx_n_s_frequency, __pyx_t_1, 0, &__pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2606, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
2607:
+2608: return mus_any.from_ptr(cclm.mus_make_pulse_train(frequency, amplitude, phase))
__Pyx_XDECREF((PyObject *)__pyx_r); __pyx_t_4 = ((PyObject *)__pyx_vtabptr_8pysndlib_3clm_mus_any->from_ptr(mus_make_pulse_train(__pyx_v_frequency, __pyx_v_amplitude, __pyx_v_phase), NULL)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2608, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_r = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_t_4); __pyx_t_4 = 0; goto __pyx_L0;
2609:
+2610: cpdef cython.double pulse_train(mus_any gen, cython.double fm=0.0):
static PyObject *__pyx_pw_8pysndlib_3clm_223pulse_train(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static double __pyx_f_8pysndlib_3clm_pulse_train(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_8pysndlib_3clm_pulse_train *__pyx_optional_args) {
double __pyx_v_fm = ((double)0.0);
double __pyx_r;
if (__pyx_optional_args) {
if (__pyx_optional_args->__pyx_n > 0) {
__pyx_v_fm = __pyx_optional_args->fm;
}
}
/* … */
/* function exit code */
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_223pulse_train(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_222pulse_train, "\n next pulse train sample from generator.\n \n :param gen: pulse_train gen\n :param fm: fm input\n :rtype: float\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_223pulse_train = {"pulse_train", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_223pulse_train, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_222pulse_train};
static PyObject *__pyx_pw_8pysndlib_3clm_223pulse_train(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = 0;
double __pyx_v_fm;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("pulse_train (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gen,&__pyx_n_s_fm,0};
PyObject* values[2] = {0,0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_gen)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2610, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_fm);
if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2610, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "pulse_train") < 0)) __PYX_ERR(0, 2610, __pyx_L3_error)
}
} else {
switch (__pyx_nargs) {
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
break;
default: goto __pyx_L5_argtuple_error;
}
}
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)values[0]);
if (values[1]) {
__pyx_v_fm = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_fm == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2610, __pyx_L3_error)
} else {
__pyx_v_fm = ((double)0.0);
}
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("pulse_train", 0, 1, 2, __pyx_nargs); __PYX_ERR(0, 2610, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.pulse_train", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gen), __pyx_ptype_8pysndlib_3clm_mus_any, 1, "gen", 0))) __PYX_ERR(0, 2610, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_222pulse_train(__pyx_self, __pyx_v_gen, __pyx_v_fm);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_222pulse_train(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, double __pyx_v_fm) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_2.__pyx_n = 1;
__pyx_t_2.fm = __pyx_v_fm;
__pyx_t_1 = __pyx_f_8pysndlib_3clm_pulse_train(__pyx_v_gen, 0, &__pyx_t_2); if (unlikely(__pyx_t_1 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2610, __pyx_L1_error)
__pyx_t_3 = PyFloat_FromDouble(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2610, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__pyx_r = __pyx_t_3;
__pyx_t_3 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_3);
__Pyx_AddTraceback("pysndlib.clm.pulse_train", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_codeobj__338 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__291, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_pulse_train, 2610, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__338)) __PYX_ERR(0, 2610, __pyx_L1_error)
/* … */
__pyx_t_43 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_223pulse_train, 0, __pyx_n_s_pulse_train, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__338)); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 2610, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
__Pyx_CyFunction_SetDefaultsTuple(__pyx_t_43, __pyx_tuple__339);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_pulse_train, __pyx_t_43) < 0) __PYX_ERR(0, 2610, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
__pyx_tuple__339 = PyTuple_Pack(1, __pyx_float_0_0); if (unlikely(!__pyx_tuple__339)) __PYX_ERR(0, 2610, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__339);
__Pyx_GIVEREF(__pyx_tuple__339);
2611: """
2612: next pulse train sample from generator.
2613:
2614: :param gen: pulse_train gen
2615: :param fm: fm input
2616: :rtype: float
2617: """
+2618: return cclm.mus_pulse_train(gen._ptr, fm)
__pyx_r = mus_pulse_train(__pyx_v_gen->_ptr, __pyx_v_fm); goto __pyx_L0;
2619:
2620:
+2621: cpdef cython.double pulse_train_unmodulated(mus_any gen):
static PyObject *__pyx_pw_8pysndlib_3clm_225pulse_train_unmodulated(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static double __pyx_f_8pysndlib_3clm_pulse_train_unmodulated(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, CYTHON_UNUSED int __pyx_skip_dispatch) {
double __pyx_r;
/* … */
/* function exit code */
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_225pulse_train_unmodulated(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_224pulse_train_unmodulated, "\n next pulse train sample from generator. unmodulated\n :param gen: pulse_train gen\n :rtype: float\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_225pulse_train_unmodulated = {"pulse_train_unmodulated", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_225pulse_train_unmodulated, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_224pulse_train_unmodulated};
static PyObject *__pyx_pw_8pysndlib_3clm_225pulse_train_unmodulated(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("pulse_train_unmodulated (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gen,0};
PyObject* values[1] = {0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_gen)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2621, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "pulse_train_unmodulated") < 0)) __PYX_ERR(0, 2621, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 1)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
}
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)values[0]);
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("pulse_train_unmodulated", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 2621, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.pulse_train_unmodulated", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gen), __pyx_ptype_8pysndlib_3clm_mus_any, 1, "gen", 0))) __PYX_ERR(0, 2621, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_224pulse_train_unmodulated(__pyx_self, __pyx_v_gen);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_224pulse_train_unmodulated(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8pysndlib_3clm_pulse_train_unmodulated(__pyx_v_gen, 0); if (unlikely(__pyx_t_1 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2621, __pyx_L1_error)
__pyx_t_2 = PyFloat_FromDouble(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2621, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("pysndlib.clm.pulse_train_unmodulated", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_43 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_225pulse_train_unmodulated, 0, __pyx_n_s_pulse_train_unmodulated, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__340)); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 2621, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_pulse_train_unmodulated, __pyx_t_43) < 0) __PYX_ERR(0, 2621, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
/* … */
__pyx_codeobj__340 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__56, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_pulse_train_unmodulated, 2621, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__340)) __PYX_ERR(0, 2621, __pyx_L1_error)
2622: """
2623: next pulse train sample from generator. unmodulated
2624: :param gen: pulse_train gen
2625: :rtype: float
2626: """
+2627: return cclm.mus_pulse_train_unmodulated(gen._ptr)
__pyx_r = mus_pulse_train_unmodulated(__pyx_v_gen->_ptr); goto __pyx_L0;
2628:
+2629: cpdef bint is_pulse_train(mus_any gen):
static PyObject *__pyx_pw_8pysndlib_3clm_227is_pulse_train(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static int __pyx_f_8pysndlib_3clm_is_pulse_train(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, CYTHON_UNUSED int __pyx_skip_dispatch) {
int __pyx_r;
/* … */
/* function exit code */
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_227is_pulse_train(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_226is_pulse_train, "\n returns True if gen is a pulse_train.\n \n :param gen: gen\n :rtype: bool\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_227is_pulse_train = {"is_pulse_train", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_227is_pulse_train, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_226is_pulse_train};
static PyObject *__pyx_pw_8pysndlib_3clm_227is_pulse_train(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("is_pulse_train (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gen,0};
PyObject* values[1] = {0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_gen)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2629, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "is_pulse_train") < 0)) __PYX_ERR(0, 2629, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 1)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
}
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)values[0]);
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("is_pulse_train", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 2629, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.is_pulse_train", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gen), __pyx_ptype_8pysndlib_3clm_mus_any, 1, "gen", 0))) __PYX_ERR(0, 2629, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_226is_pulse_train(__pyx_self, __pyx_v_gen);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_226is_pulse_train(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8pysndlib_3clm_is_pulse_train(__pyx_v_gen, 0); if (unlikely(__pyx_t_1 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2629, __pyx_L1_error)
__pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2629, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("pysndlib.clm.is_pulse_train", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_43 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_227is_pulse_train, 0, __pyx_n_s_is_pulse_train, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__341)); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 2629, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_is_pulse_train, __pyx_t_43) < 0) __PYX_ERR(0, 2629, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
/* … */
__pyx_codeobj__341 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__56, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_is_pulse_train, 2629, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__341)) __PYX_ERR(0, 2629, __pyx_L1_error)
2630: """
2631: returns True if gen is a pulse_train.
2632:
2633: :param gen: gen
2634: :rtype: bool
2635: """
+2636: return cclm.mus_is_pulse_train(gen._ptr)
__pyx_r = mus_is_pulse_train(__pyx_v_gen->_ptr); goto __pyx_L0;
2637:
2638: # ---------------- ncos ---------------- #
2639:
+2640: cpdef mus_any make_ncos(cython.double frequency, cython.int n=1):
static PyObject *__pyx_pw_8pysndlib_3clm_229make_ncos(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_f_8pysndlib_3clm_make_ncos(double __pyx_v_frequency, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_8pysndlib_3clm_make_ncos *__pyx_optional_args) {
int __pyx_v_n = ((int)1);
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_r = NULL;
if (__pyx_optional_args) {
if (__pyx_optional_args->__pyx_n > 0) {
__pyx_v_n = __pyx_optional_args->n;
}
}
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_AddTraceback("pysndlib.clm.make_ncos", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XGIVEREF((PyObject *)__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_229make_ncos(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_228make_ncos, "\n return a new ncos generator, producing a sum of 'n' equal amplitude cosines.\n \n :param frequency: frequency of generator\n :param n: number of cosines\n :return: ncos gen\n :rtype: mus_any\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_229make_ncos = {"make_ncos", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_229make_ncos, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_228make_ncos};
static PyObject *__pyx_pw_8pysndlib_3clm_229make_ncos(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
double __pyx_v_frequency;
int __pyx_v_n;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("make_ncos (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_frequency,&__pyx_n_s_n,0};
PyObject* values[2] = {0,0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_frequency)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2640, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_n);
if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2640, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "make_ncos") < 0)) __PYX_ERR(0, 2640, __pyx_L3_error)
}
} else {
switch (__pyx_nargs) {
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
break;
default: goto __pyx_L5_argtuple_error;
}
}
__pyx_v_frequency = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_frequency == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2640, __pyx_L3_error)
if (values[1]) {
__pyx_v_n = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_n == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2640, __pyx_L3_error)
} else {
__pyx_v_n = ((int)1);
}
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("make_ncos", 0, 1, 2, __pyx_nargs); __PYX_ERR(0, 2640, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.make_ncos", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_8pysndlib_3clm_228make_ncos(__pyx_self, __pyx_v_frequency, __pyx_v_n);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_228make_ncos(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_frequency, int __pyx_v_n) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_2.__pyx_n = 1;
__pyx_t_2.n = __pyx_v_n;
__pyx_t_1 = ((PyObject *)__pyx_f_8pysndlib_3clm_make_ncos(__pyx_v_frequency, 0, &__pyx_t_2)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2640, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("pysndlib.clm.make_ncos", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_tuple__342 = PyTuple_Pack(2, __pyx_n_s_frequency, __pyx_n_s_n); if (unlikely(!__pyx_tuple__342)) __PYX_ERR(0, 2640, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__342);
__Pyx_GIVEREF(__pyx_tuple__342);
/* … */
__pyx_t_43 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_229make_ncos, 0, __pyx_n_s_make_ncos, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__343)); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 2640, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
__Pyx_CyFunction_SetDefaultsTuple(__pyx_t_43, __pyx_tuple__117);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_make_ncos, __pyx_t_43) < 0) __PYX_ERR(0, 2640, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
__pyx_codeobj__343 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__342, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_make_ncos, 2640, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__343)) __PYX_ERR(0, 2640, __pyx_L1_error)
/* … */
struct __pyx_opt_args_8pysndlib_3clm_make_ncos {
int __pyx_n;
int n;
};
2641: """
2642: return a new ncos generator, producing a sum of 'n' equal amplitude cosines.
2643:
2644: :param frequency: frequency of generator
2645: :param n: number of cosines
2646: :return: ncos gen
2647: :rtype: mus_any
2648: """
+2649: check_range('frequency', frequency, 0.0, get_srate() / 2)
__pyx_t_1 = PyFloat_FromDouble(__pyx_v_frequency); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2649, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __pyx_f_8pysndlib_3clm_get_srate(0); if (unlikely(__pyx_t_2 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2649, __pyx_L1_error) __pyx_t_3 = PyFloat_FromDouble((__pyx_t_2 / 2.0)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2649, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_5.__pyx_n = 2; __pyx_t_5.low = __pyx_float_0_0; __pyx_t_5.high = __pyx_t_3; __pyx_t_4 = __pyx_f_8pysndlib_3clm_check_range(__pyx_n_s_frequency, __pyx_t_1, 0, &__pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2649, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+2650: check_range('n', n, 0, None)
__pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_n); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2650, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5.__pyx_n = 2; __pyx_t_5.low = __pyx_int_0; __pyx_t_5.high = Py_None; __pyx_t_3 = __pyx_f_8pysndlib_3clm_check_range(__pyx_n_s_n, __pyx_t_4, 0, &__pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2650, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+2651: return mus_any.from_ptr(cclm.mus_make_ncos(frequency, n))
__Pyx_XDECREF((PyObject *)__pyx_r); __pyx_t_3 = ((PyObject *)__pyx_vtabptr_8pysndlib_3clm_mus_any->from_ptr(mus_make_ncos(__pyx_v_frequency, __pyx_v_n), NULL)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2651, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_r = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_t_3); __pyx_t_3 = 0; goto __pyx_L0;
2652:
+2653: cpdef cython.double ncos(mus_any gen, cython.double mus_any, fm=0.0):
static PyObject *__pyx_pw_8pysndlib_3clm_231ncos(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static double __pyx_f_8pysndlib_3clm_ncos(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, CYTHON_UNUSED double __pyx_v_mus_any, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_8pysndlib_3clm_ncos *__pyx_optional_args) {
PyObject *__pyx_v_fm = ((PyObject *)__pyx_float_0_0);
double __pyx_r;
if (__pyx_optional_args) {
if (__pyx_optional_args->__pyx_n > 0) {
__pyx_v_fm = __pyx_optional_args->fm;
}
}
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_AddTraceback("pysndlib.clm.ncos", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = -1;
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_231ncos(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_230ncos, "\n get the next sample from 'gen', an ncos generator.\n \n :param gen: ncos gen\n :param fm: fm input\n :rtype: float\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_231ncos = {"ncos", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_231ncos, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_230ncos};
static PyObject *__pyx_pw_8pysndlib_3clm_231ncos(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = 0;
double __pyx_v_mus_any;
PyObject *__pyx_v_fm = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("ncos (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gen,&__pyx_n_s_mus_any,&__pyx_n_s_fm,0};
PyObject* values[3] = {0,0,0};
values[2] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)__pyx_float_0_0));
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_gen)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2653, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_mus_any)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2653, __pyx_L3_error)
else {
__Pyx_RaiseArgtupleInvalid("ncos", 0, 2, 3, 1); __PYX_ERR(0, 2653, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 2:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_fm);
if (value) { values[2] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2653, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "ncos") < 0)) __PYX_ERR(0, 2653, __pyx_L3_error)
}
} else {
switch (__pyx_nargs) {
case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
break;
default: goto __pyx_L5_argtuple_error;
}
}
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)values[0]);
__pyx_v_mus_any = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_mus_any == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2653, __pyx_L3_error)
__pyx_v_fm = values[2];
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("ncos", 0, 2, 3, __pyx_nargs); __PYX_ERR(0, 2653, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.ncos", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gen), __pyx_ptype_8pysndlib_3clm_mus_any, 1, "gen", 0))) __PYX_ERR(0, 2653, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_230ncos(__pyx_self, __pyx_v_gen, __pyx_v_mus_any, __pyx_v_fm);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_230ncos(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, double __pyx_v_mus_any, PyObject *__pyx_v_fm) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_2.__pyx_n = 1;
__pyx_t_2.fm = __pyx_v_fm;
__pyx_t_1 = __pyx_f_8pysndlib_3clm_ncos(__pyx_v_gen, __pyx_v_mus_any, 0, &__pyx_t_2); if (unlikely(__pyx_t_1 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2653, __pyx_L1_error)
__pyx_t_3 = PyFloat_FromDouble(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2653, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__pyx_r = __pyx_t_3;
__pyx_t_3 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_3);
__Pyx_AddTraceback("pysndlib.clm.ncos", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_tuple__344 = PyTuple_Pack(3, __pyx_n_s_gen, __pyx_n_s_mus_any, __pyx_n_s_fm); if (unlikely(!__pyx_tuple__344)) __PYX_ERR(0, 2653, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__344);
__Pyx_GIVEREF(__pyx_tuple__344);
__pyx_codeobj__345 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__344, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_ncos, 2653, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__345)) __PYX_ERR(0, 2653, __pyx_L1_error)
/* … */
__pyx_t_43 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_231ncos, 0, __pyx_n_s_ncos, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__345)); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 2653, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
__Pyx_CyFunction_SetDefaultsTuple(__pyx_t_43, __pyx_tuple__346);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_ncos, __pyx_t_43) < 0) __PYX_ERR(0, 2653, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
__pyx_tuple__346 = PyTuple_Pack(1, __pyx_float_0_0); if (unlikely(!__pyx_tuple__346)) __PYX_ERR(0, 2653, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__346);
__Pyx_GIVEREF(__pyx_tuple__346);
2654: """
2655: get the next sample from 'gen', an ncos generator.
2656:
2657: :param gen: ncos gen
2658: :param fm: fm input
2659: :rtype: float
2660: """
+2661: return cclm.mus_ncos(gen._ptr, fm)
__pyx_t_1 = __pyx_PyFloat_AsDouble(__pyx_v_fm); if (unlikely((__pyx_t_1 == ((mus_float_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 2661, __pyx_L1_error) __pyx_r = mus_ncos(__pyx_v_gen->_ptr, __pyx_t_1); goto __pyx_L0;
2662:
+2663: cpdef bint is_ncos(mus_any gen):
static PyObject *__pyx_pw_8pysndlib_3clm_233is_ncos(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static int __pyx_f_8pysndlib_3clm_is_ncos(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, CYTHON_UNUSED int __pyx_skip_dispatch) {
int __pyx_r;
/* … */
/* function exit code */
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_233is_ncos(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_232is_ncos, "\n returns True if gen is a ncos.\n \n :param gen: gen\n :rtype: bool\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_233is_ncos = {"is_ncos", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_233is_ncos, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_232is_ncos};
static PyObject *__pyx_pw_8pysndlib_3clm_233is_ncos(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("is_ncos (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gen,0};
PyObject* values[1] = {0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_gen)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2663, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "is_ncos") < 0)) __PYX_ERR(0, 2663, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 1)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
}
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)values[0]);
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("is_ncos", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 2663, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.is_ncos", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gen), __pyx_ptype_8pysndlib_3clm_mus_any, 1, "gen", 0))) __PYX_ERR(0, 2663, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_232is_ncos(__pyx_self, __pyx_v_gen);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_232is_ncos(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8pysndlib_3clm_is_ncos(__pyx_v_gen, 0); if (unlikely(__pyx_t_1 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2663, __pyx_L1_error)
__pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2663, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("pysndlib.clm.is_ncos", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_43 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_233is_ncos, 0, __pyx_n_s_is_ncos, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__347)); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 2663, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_is_ncos, __pyx_t_43) < 0) __PYX_ERR(0, 2663, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
/* … */
__pyx_codeobj__347 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__56, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_is_ncos, 2663, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__347)) __PYX_ERR(0, 2663, __pyx_L1_error)
2664: """
2665: returns True if gen is a ncos.
2666:
2667: :param gen: gen
2668: :rtype: bool
2669: """
+2670: return cclm.mus_is_ncos(gen._ptr)
__pyx_r = mus_is_ncos(__pyx_v_gen->_ptr); goto __pyx_L0;
2671:
2672:
2673: # ---------------- nsin ---------------- #
+2674: cpdef mus_any make_nsin(cython.double frequency, cython.int n =1):
static PyObject *__pyx_pw_8pysndlib_3clm_235make_nsin(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_f_8pysndlib_3clm_make_nsin(double __pyx_v_frequency, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_8pysndlib_3clm_make_nsin *__pyx_optional_args) {
int __pyx_v_n = ((int)1);
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_r = NULL;
if (__pyx_optional_args) {
if (__pyx_optional_args->__pyx_n > 0) {
__pyx_v_n = __pyx_optional_args->n;
}
}
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_AddTraceback("pysndlib.clm.make_nsin", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XGIVEREF((PyObject *)__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_235make_nsin(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_234make_nsin, "\n return a new nsin generator, producing a sum of 'n' equal amplitude sines.\n \n :param frequency: frequency of generator\n :param n: number of sines\n :return: nsin gen\n :rtype: mus_any\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_235make_nsin = {"make_nsin", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_235make_nsin, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_234make_nsin};
static PyObject *__pyx_pw_8pysndlib_3clm_235make_nsin(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
double __pyx_v_frequency;
int __pyx_v_n;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("make_nsin (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_frequency,&__pyx_n_s_n,0};
PyObject* values[2] = {0,0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_frequency)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2674, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_n);
if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2674, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "make_nsin") < 0)) __PYX_ERR(0, 2674, __pyx_L3_error)
}
} else {
switch (__pyx_nargs) {
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
break;
default: goto __pyx_L5_argtuple_error;
}
}
__pyx_v_frequency = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_frequency == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2674, __pyx_L3_error)
if (values[1]) {
__pyx_v_n = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_n == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2674, __pyx_L3_error)
} else {
__pyx_v_n = ((int)1);
}
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("make_nsin", 0, 1, 2, __pyx_nargs); __PYX_ERR(0, 2674, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.make_nsin", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_8pysndlib_3clm_234make_nsin(__pyx_self, __pyx_v_frequency, __pyx_v_n);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_234make_nsin(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_frequency, int __pyx_v_n) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_2.__pyx_n = 1;
__pyx_t_2.n = __pyx_v_n;
__pyx_t_1 = ((PyObject *)__pyx_f_8pysndlib_3clm_make_nsin(__pyx_v_frequency, 0, &__pyx_t_2)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2674, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("pysndlib.clm.make_nsin", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_43 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_235make_nsin, 0, __pyx_n_s_make_nsin, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__348)); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 2674, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
__Pyx_CyFunction_SetDefaultsTuple(__pyx_t_43, __pyx_tuple__117);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_make_nsin, __pyx_t_43) < 0) __PYX_ERR(0, 2674, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
/* … */
__pyx_codeobj__348 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__342, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_make_nsin, 2674, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__348)) __PYX_ERR(0, 2674, __pyx_L1_error)
/* … */
struct __pyx_opt_args_8pysndlib_3clm_make_nsin {
int __pyx_n;
int n;
};
2675: """
2676: return a new nsin generator, producing a sum of 'n' equal amplitude sines.
2677:
2678: :param frequency: frequency of generator
2679: :param n: number of sines
2680: :return: nsin gen
2681: :rtype: mus_any
2682: """
2683:
+2684: check_range('frequency', frequency, 0.0, get_srate() / 2)
__pyx_t_1 = PyFloat_FromDouble(__pyx_v_frequency); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2684, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __pyx_f_8pysndlib_3clm_get_srate(0); if (unlikely(__pyx_t_2 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2684, __pyx_L1_error) __pyx_t_3 = PyFloat_FromDouble((__pyx_t_2 / 2.0)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2684, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_5.__pyx_n = 2; __pyx_t_5.low = __pyx_float_0_0; __pyx_t_5.high = __pyx_t_3; __pyx_t_4 = __pyx_f_8pysndlib_3clm_check_range(__pyx_n_s_frequency, __pyx_t_1, 0, &__pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2684, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+2685: check_range('n', n, 0, None)
__pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_n); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2685, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5.__pyx_n = 2; __pyx_t_5.low = __pyx_int_0; __pyx_t_5.high = Py_None; __pyx_t_3 = __pyx_f_8pysndlib_3clm_check_range(__pyx_n_s_n, __pyx_t_4, 0, &__pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2685, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
2686:
+2687: return mus_any.from_ptr(cclm.mus_make_nsin(frequency, n))
__Pyx_XDECREF((PyObject *)__pyx_r); __pyx_t_3 = ((PyObject *)__pyx_vtabptr_8pysndlib_3clm_mus_any->from_ptr(mus_make_nsin(__pyx_v_frequency, __pyx_v_n), NULL)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2687, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_r = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_t_3); __pyx_t_3 = 0; goto __pyx_L0;
2688:
+2689: cpdef cython.double nsin(mus_any gen, cython.double fm=0.0):
static PyObject *__pyx_pw_8pysndlib_3clm_237nsin(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static double __pyx_f_8pysndlib_3clm_nsin(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_8pysndlib_3clm_nsin *__pyx_optional_args) {
double __pyx_v_fm = ((double)0.0);
double __pyx_r;
if (__pyx_optional_args) {
if (__pyx_optional_args->__pyx_n > 0) {
__pyx_v_fm = __pyx_optional_args->fm;
}
}
/* … */
/* function exit code */
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_237nsin(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_236nsin, "\n get the next sample from 'gen', an nsin generator.\n \n :param gen: ncos gen\n :param fm: fm input\n :rtype: float\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_237nsin = {"nsin", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_237nsin, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_236nsin};
static PyObject *__pyx_pw_8pysndlib_3clm_237nsin(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = 0;
double __pyx_v_fm;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("nsin (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gen,&__pyx_n_s_fm,0};
PyObject* values[2] = {0,0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_gen)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2689, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_fm);
if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2689, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "nsin") < 0)) __PYX_ERR(0, 2689, __pyx_L3_error)
}
} else {
switch (__pyx_nargs) {
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
break;
default: goto __pyx_L5_argtuple_error;
}
}
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)values[0]);
if (values[1]) {
__pyx_v_fm = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_fm == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2689, __pyx_L3_error)
} else {
__pyx_v_fm = ((double)0.0);
}
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("nsin", 0, 1, 2, __pyx_nargs); __PYX_ERR(0, 2689, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.nsin", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gen), __pyx_ptype_8pysndlib_3clm_mus_any, 1, "gen", 0))) __PYX_ERR(0, 2689, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_236nsin(__pyx_self, __pyx_v_gen, __pyx_v_fm);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_236nsin(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, double __pyx_v_fm) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_2.__pyx_n = 1;
__pyx_t_2.fm = __pyx_v_fm;
__pyx_t_1 = __pyx_f_8pysndlib_3clm_nsin(__pyx_v_gen, 0, &__pyx_t_2); if (unlikely(__pyx_t_1 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2689, __pyx_L1_error)
__pyx_t_3 = PyFloat_FromDouble(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2689, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__pyx_r = __pyx_t_3;
__pyx_t_3 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_3);
__Pyx_AddTraceback("pysndlib.clm.nsin", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_codeobj__349 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__291, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_nsin, 2689, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__349)) __PYX_ERR(0, 2689, __pyx_L1_error)
/* … */
__pyx_t_43 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_237nsin, 0, __pyx_n_s_nsin, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__349)); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 2689, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
__Pyx_CyFunction_SetDefaultsTuple(__pyx_t_43, __pyx_tuple__350);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_nsin, __pyx_t_43) < 0) __PYX_ERR(0, 2689, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
__pyx_tuple__350 = PyTuple_Pack(1, __pyx_float_0_0); if (unlikely(!__pyx_tuple__350)) __PYX_ERR(0, 2689, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__350);
__Pyx_GIVEREF(__pyx_tuple__350);
2690: """
2691: get the next sample from 'gen', an nsin generator.
2692:
2693: :param gen: ncos gen
2694: :param fm: fm input
2695: :rtype: float
2696: """
+2697: return cclm.mus_nsin(gen._ptr, fm)
__pyx_r = mus_nsin(__pyx_v_gen->_ptr, __pyx_v_fm); goto __pyx_L0;
2698:
+2699: cpdef bint is_nsin(mus_any gen ):
static PyObject *__pyx_pw_8pysndlib_3clm_239is_nsin(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static int __pyx_f_8pysndlib_3clm_is_nsin(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, CYTHON_UNUSED int __pyx_skip_dispatch) {
int __pyx_r;
/* … */
/* function exit code */
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_239is_nsin(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_238is_nsin, "\n returns True if gen is a nsin.\n \n :param gen: gen\n :rtype: bool\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_239is_nsin = {"is_nsin", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_239is_nsin, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_238is_nsin};
static PyObject *__pyx_pw_8pysndlib_3clm_239is_nsin(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("is_nsin (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gen,0};
PyObject* values[1] = {0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_gen)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2699, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "is_nsin") < 0)) __PYX_ERR(0, 2699, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 1)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
}
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)values[0]);
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("is_nsin", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 2699, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.is_nsin", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gen), __pyx_ptype_8pysndlib_3clm_mus_any, 1, "gen", 0))) __PYX_ERR(0, 2699, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_238is_nsin(__pyx_self, __pyx_v_gen);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_238is_nsin(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8pysndlib_3clm_is_nsin(__pyx_v_gen, 0); if (unlikely(__pyx_t_1 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2699, __pyx_L1_error)
__pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2699, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("pysndlib.clm.is_nsin", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_43 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_239is_nsin, 0, __pyx_n_s_is_nsin, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__351)); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 2699, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_is_nsin, __pyx_t_43) < 0) __PYX_ERR(0, 2699, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
/* … */
__pyx_codeobj__351 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__56, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_is_nsin, 2699, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__351)) __PYX_ERR(0, 2699, __pyx_L1_error)
2700: """
2701: returns True if gen is a nsin.
2702:
2703: :param gen: gen
2704: :rtype: bool
2705: """
+2706: return cclm.mus_is_nsin(gen._ptr)
__pyx_r = mus_is_nsin(__pyx_v_gen->_ptr); goto __pyx_L0;
2707:
2708: # ---------------- nrxysin and nrxycos ---------------- #
2709:
+2710: cpdef mus_any make_nrxysin( cython.double frequency, cython.double ratio=1., cython.int n=1, cython.double r=.5):
static PyObject *__pyx_pw_8pysndlib_3clm_241make_nrxysin(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_f_8pysndlib_3clm_make_nrxysin(double __pyx_v_frequency, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_8pysndlib_3clm_make_nrxysin *__pyx_optional_args) {
double __pyx_v_ratio = ((double)1.);
int __pyx_v_n = ((int)1);
double __pyx_v_r = ((double).5);
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_r = NULL;
if (__pyx_optional_args) {
if (__pyx_optional_args->__pyx_n > 0) {
__pyx_v_ratio = __pyx_optional_args->ratio;
if (__pyx_optional_args->__pyx_n > 1) {
__pyx_v_n = __pyx_optional_args->n;
if (__pyx_optional_args->__pyx_n > 2) {
__pyx_v_r = __pyx_optional_args->r;
}
}
}
}
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_AddTraceback("pysndlib.clm.make_nrxysin", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XGIVEREF((PyObject *)__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_241make_nrxysin(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_240make_nrxysin, "\n return a new nrxysin generator.\n \n :param frequency: frequency of generator\n :param ratio: ratio between frequency and the spacing between successive sidebands\n :param n: number of sidebands\n :param r: amplitude ratio between successive sidebands (-1.0 < r < 1.0)\n :return: nrxysin gen\n :rtype: mus_any\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_241make_nrxysin = {"make_nrxysin", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_241make_nrxysin, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_240make_nrxysin};
static PyObject *__pyx_pw_8pysndlib_3clm_241make_nrxysin(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
double __pyx_v_frequency;
double __pyx_v_ratio;
int __pyx_v_n;
double __pyx_v_r;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("make_nrxysin (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_frequency,&__pyx_n_s_ratio,&__pyx_n_s_n,&__pyx_n_s_r,0};
PyObject* values[4] = {0,0,0,0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
CYTHON_FALLTHROUGH;
case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_frequency)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2710, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_ratio);
if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2710, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 2:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_n);
if (value) { values[2] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2710, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 3:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_r);
if (value) { values[3] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2710, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "make_nrxysin") < 0)) __PYX_ERR(0, 2710, __pyx_L3_error)
}
} else {
switch (__pyx_nargs) {
case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
CYTHON_FALLTHROUGH;
case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
break;
default: goto __pyx_L5_argtuple_error;
}
}
__pyx_v_frequency = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_frequency == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2710, __pyx_L3_error)
if (values[1]) {
__pyx_v_ratio = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_ratio == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2710, __pyx_L3_error)
} else {
__pyx_v_ratio = ((double)1.);
}
if (values[2]) {
__pyx_v_n = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_n == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2710, __pyx_L3_error)
} else {
__pyx_v_n = ((int)1);
}
if (values[3]) {
__pyx_v_r = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_r == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2710, __pyx_L3_error)
} else {
__pyx_v_r = ((double).5);
}
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("make_nrxysin", 0, 1, 4, __pyx_nargs); __PYX_ERR(0, 2710, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.make_nrxysin", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_8pysndlib_3clm_240make_nrxysin(__pyx_self, __pyx_v_frequency, __pyx_v_ratio, __pyx_v_n, __pyx_v_r);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_240make_nrxysin(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_frequency, double __pyx_v_ratio, int __pyx_v_n, double __pyx_v_r) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_2.__pyx_n = 3;
__pyx_t_2.ratio = __pyx_v_ratio;
__pyx_t_2.n = __pyx_v_n;
__pyx_t_2.r = __pyx_v_r;
__pyx_t_1 = ((PyObject *)__pyx_f_8pysndlib_3clm_make_nrxysin(__pyx_v_frequency, 0, &__pyx_t_2)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2710, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("pysndlib.clm.make_nrxysin", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_tuple__352 = PyTuple_Pack(4, __pyx_n_s_frequency, __pyx_n_s_ratio, __pyx_n_s_n, __pyx_n_s_r); if (unlikely(!__pyx_tuple__352)) __PYX_ERR(0, 2710, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__352);
__Pyx_GIVEREF(__pyx_tuple__352);
__pyx_codeobj__353 = (PyObject*)__Pyx_PyCode_New(4, 0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__352, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_make_nrxysin, 2710, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__353)) __PYX_ERR(0, 2710, __pyx_L1_error)
/* … */
__pyx_t_43 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_241make_nrxysin, 0, __pyx_n_s_make_nrxysin, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__353)); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 2710, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
__Pyx_CyFunction_SetDefaultsTuple(__pyx_t_43, __pyx_tuple__354);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_make_nrxysin, __pyx_t_43) < 0) __PYX_ERR(0, 2710, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
__pyx_tuple__354 = PyTuple_Pack(3, __pyx_float_1_, __pyx_int_1, __pyx_float__5); if (unlikely(!__pyx_tuple__354)) __PYX_ERR(0, 2710, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__354);
__Pyx_GIVEREF(__pyx_tuple__354);
/* … */
struct __pyx_opt_args_8pysndlib_3clm_make_nrxysin {
int __pyx_n;
double ratio;
int n;
double r;
};
2711: """
2712: return a new nrxysin generator.
2713:
2714: :param frequency: frequency of generator
2715: :param ratio: ratio between frequency and the spacing between successive sidebands
2716: :param n: number of sidebands
2717: :param r: amplitude ratio between successive sidebands (-1.0 < r < 1.0)
2718: :return: nrxysin gen
2719: :rtype: mus_any
2720: """
+2721: check_range('frequency', frequency, 0.0, get_srate() / 2)
__pyx_t_1 = PyFloat_FromDouble(__pyx_v_frequency); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2721, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __pyx_f_8pysndlib_3clm_get_srate(0); if (unlikely(__pyx_t_2 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2721, __pyx_L1_error) __pyx_t_3 = PyFloat_FromDouble((__pyx_t_2 / 2.0)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2721, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_5.__pyx_n = 2; __pyx_t_5.low = __pyx_float_0_0; __pyx_t_5.high = __pyx_t_3; __pyx_t_4 = __pyx_f_8pysndlib_3clm_check_range(__pyx_n_s_frequency, __pyx_t_1, 0, &__pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2721, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+2722: check_range('r', r, -1.0, 1.0)
__pyx_t_4 = PyFloat_FromDouble(__pyx_v_r); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2722, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5.__pyx_n = 2; __pyx_t_5.low = __pyx_float_neg_1_0; __pyx_t_5.high = __pyx_float_1_0; __pyx_t_3 = __pyx_f_8pysndlib_3clm_check_range(__pyx_n_s_r, __pyx_t_4, 0, &__pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2722, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+2723: check_range('n', n, 0, None)
__pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_n); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2723, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_5.__pyx_n = 2; __pyx_t_5.low = __pyx_int_0; __pyx_t_5.high = Py_None; __pyx_t_4 = __pyx_f_8pysndlib_3clm_check_range(__pyx_n_s_n, __pyx_t_3, 0, &__pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2723, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
2724:
+2725: return mus_any.from_ptr(cclm.mus_make_nrxysin(frequency, ratio, n, r))
__Pyx_XDECREF((PyObject *)__pyx_r); __pyx_t_4 = ((PyObject *)__pyx_vtabptr_8pysndlib_3clm_mus_any->from_ptr(mus_make_nrxysin(__pyx_v_frequency, __pyx_v_ratio, __pyx_v_n, __pyx_v_r), NULL)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2725, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_r = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_t_4); __pyx_t_4 = 0; goto __pyx_L0;
2726:
+2727: cpdef cython.double nrxysin(mus_any gen, cython.double fm=0.):
static PyObject *__pyx_pw_8pysndlib_3clm_243nrxysin(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static double __pyx_f_8pysndlib_3clm_nrxysin(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_8pysndlib_3clm_nrxysin *__pyx_optional_args) {
double __pyx_v_fm = ((double)0.);
double __pyx_r;
if (__pyx_optional_args) {
if (__pyx_optional_args->__pyx_n > 0) {
__pyx_v_fm = __pyx_optional_args->fm;
}
}
/* … */
/* function exit code */
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_243nrxysin(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_242nrxysin, "\n next sample of nrxysin generator.\n \n :param gen: ncos gen\n :param fm: fm input\n :rtype: float\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_243nrxysin = {"nrxysin", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_243nrxysin, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_242nrxysin};
static PyObject *__pyx_pw_8pysndlib_3clm_243nrxysin(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = 0;
double __pyx_v_fm;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("nrxysin (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gen,&__pyx_n_s_fm,0};
PyObject* values[2] = {0,0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_gen)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2727, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_fm);
if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2727, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "nrxysin") < 0)) __PYX_ERR(0, 2727, __pyx_L3_error)
}
} else {
switch (__pyx_nargs) {
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
break;
default: goto __pyx_L5_argtuple_error;
}
}
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)values[0]);
if (values[1]) {
__pyx_v_fm = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_fm == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2727, __pyx_L3_error)
} else {
__pyx_v_fm = ((double)0.);
}
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("nrxysin", 0, 1, 2, __pyx_nargs); __PYX_ERR(0, 2727, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.nrxysin", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gen), __pyx_ptype_8pysndlib_3clm_mus_any, 1, "gen", 0))) __PYX_ERR(0, 2727, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_242nrxysin(__pyx_self, __pyx_v_gen, __pyx_v_fm);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_242nrxysin(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, double __pyx_v_fm) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_2.__pyx_n = 1;
__pyx_t_2.fm = __pyx_v_fm;
__pyx_t_1 = __pyx_f_8pysndlib_3clm_nrxysin(__pyx_v_gen, 0, &__pyx_t_2); if (unlikely(__pyx_t_1 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2727, __pyx_L1_error)
__pyx_t_3 = PyFloat_FromDouble(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2727, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__pyx_r = __pyx_t_3;
__pyx_t_3 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_3);
__Pyx_AddTraceback("pysndlib.clm.nrxysin", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_codeobj__355 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__291, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_nrxysin, 2727, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__355)) __PYX_ERR(0, 2727, __pyx_L1_error)
/* … */
__pyx_t_43 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_243nrxysin, 0, __pyx_n_s_nrxysin, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__355)); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 2727, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
__Pyx_CyFunction_SetDefaultsTuple(__pyx_t_43, __pyx_tuple__356);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_nrxysin, __pyx_t_43) < 0) __PYX_ERR(0, 2727, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
__pyx_tuple__356 = PyTuple_Pack(1, __pyx_float_0_); if (unlikely(!__pyx_tuple__356)) __PYX_ERR(0, 2727, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__356);
__Pyx_GIVEREF(__pyx_tuple__356);
2728: """
2729: next sample of nrxysin generator.
2730:
2731: :param gen: ncos gen
2732: :param fm: fm input
2733: :rtype: float
2734: """
+2735: return cclm.mus_nrxysin(gen._ptr, fm)
__pyx_r = mus_nrxysin(__pyx_v_gen->_ptr, __pyx_v_fm); goto __pyx_L0;
2736:
+2737: cpdef bint is_nrxysin(mus_any gen):
static PyObject *__pyx_pw_8pysndlib_3clm_245is_nrxysin(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static int __pyx_f_8pysndlib_3clm_is_nrxysin(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, CYTHON_UNUSED int __pyx_skip_dispatch) {
int __pyx_r;
/* … */
/* function exit code */
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_245is_nrxysin(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_244is_nrxysin, "\n returns True if gen is a nrxysin.\n \n :param gen: gen\n :rtype: bool\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_245is_nrxysin = {"is_nrxysin", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_245is_nrxysin, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_244is_nrxysin};
static PyObject *__pyx_pw_8pysndlib_3clm_245is_nrxysin(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("is_nrxysin (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gen,0};
PyObject* values[1] = {0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_gen)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2737, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "is_nrxysin") < 0)) __PYX_ERR(0, 2737, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 1)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
}
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)values[0]);
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("is_nrxysin", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 2737, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.is_nrxysin", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gen), __pyx_ptype_8pysndlib_3clm_mus_any, 1, "gen", 0))) __PYX_ERR(0, 2737, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_244is_nrxysin(__pyx_self, __pyx_v_gen);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_244is_nrxysin(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8pysndlib_3clm_is_nrxysin(__pyx_v_gen, 0); if (unlikely(__pyx_t_1 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2737, __pyx_L1_error)
__pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2737, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("pysndlib.clm.is_nrxysin", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_43 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_245is_nrxysin, 0, __pyx_n_s_is_nrxysin, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__357)); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 2737, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_is_nrxysin, __pyx_t_43) < 0) __PYX_ERR(0, 2737, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
/* … */
__pyx_codeobj__357 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__56, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_is_nrxysin, 2737, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__357)) __PYX_ERR(0, 2737, __pyx_L1_error)
2738: """
2739: returns True if gen is a nrxysin.
2740:
2741: :param gen: gen
2742: :rtype: bool
2743: """
+2744: return cclm.mus_is_nrxysin(gen._ptr)
__pyx_r = mus_is_nrxysin(__pyx_v_gen->_ptr); goto __pyx_L0;
2745:
2746:
+2747: cpdef mus_any make_nrxycos(cython.double frequency , cython.double ratio=1., cython.int n=1, cython.double r=.5):
static PyObject *__pyx_pw_8pysndlib_3clm_247make_nrxycos(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_f_8pysndlib_3clm_make_nrxycos(double __pyx_v_frequency, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_8pysndlib_3clm_make_nrxycos *__pyx_optional_args) {
double __pyx_v_ratio = ((double)1.);
int __pyx_v_n = ((int)1);
double __pyx_v_r = ((double).5);
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_r = NULL;
if (__pyx_optional_args) {
if (__pyx_optional_args->__pyx_n > 0) {
__pyx_v_ratio = __pyx_optional_args->ratio;
if (__pyx_optional_args->__pyx_n > 1) {
__pyx_v_n = __pyx_optional_args->n;
if (__pyx_optional_args->__pyx_n > 2) {
__pyx_v_r = __pyx_optional_args->r;
}
}
}
}
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_AddTraceback("pysndlib.clm.make_nrxycos", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XGIVEREF((PyObject *)__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_247make_nrxycos(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_246make_nrxycos, "\n return a new nrxycos generator.\n \n :param frequency: frequency of generator\n :param ratio: ratio between frequency and the spacing between successive sidebands\n :param n: number of sidebands\n :param r: amplitude ratio between successive sidebands (-1.0 < r < 1.0)\n :return: nrxycos gen\n :rtype: mus_any\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_247make_nrxycos = {"make_nrxycos", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_247make_nrxycos, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_246make_nrxycos};
static PyObject *__pyx_pw_8pysndlib_3clm_247make_nrxycos(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
double __pyx_v_frequency;
double __pyx_v_ratio;
int __pyx_v_n;
double __pyx_v_r;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("make_nrxycos (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_frequency,&__pyx_n_s_ratio,&__pyx_n_s_n,&__pyx_n_s_r,0};
PyObject* values[4] = {0,0,0,0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
CYTHON_FALLTHROUGH;
case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_frequency)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2747, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_ratio);
if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2747, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 2:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_n);
if (value) { values[2] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2747, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 3:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_r);
if (value) { values[3] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2747, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "make_nrxycos") < 0)) __PYX_ERR(0, 2747, __pyx_L3_error)
}
} else {
switch (__pyx_nargs) {
case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
CYTHON_FALLTHROUGH;
case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
break;
default: goto __pyx_L5_argtuple_error;
}
}
__pyx_v_frequency = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_frequency == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2747, __pyx_L3_error)
if (values[1]) {
__pyx_v_ratio = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_ratio == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2747, __pyx_L3_error)
} else {
__pyx_v_ratio = ((double)1.);
}
if (values[2]) {
__pyx_v_n = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_n == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2747, __pyx_L3_error)
} else {
__pyx_v_n = ((int)1);
}
if (values[3]) {
__pyx_v_r = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_r == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2747, __pyx_L3_error)
} else {
__pyx_v_r = ((double).5);
}
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("make_nrxycos", 0, 1, 4, __pyx_nargs); __PYX_ERR(0, 2747, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.make_nrxycos", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_8pysndlib_3clm_246make_nrxycos(__pyx_self, __pyx_v_frequency, __pyx_v_ratio, __pyx_v_n, __pyx_v_r);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_246make_nrxycos(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_frequency, double __pyx_v_ratio, int __pyx_v_n, double __pyx_v_r) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_2.__pyx_n = 3;
__pyx_t_2.ratio = __pyx_v_ratio;
__pyx_t_2.n = __pyx_v_n;
__pyx_t_2.r = __pyx_v_r;
__pyx_t_1 = ((PyObject *)__pyx_f_8pysndlib_3clm_make_nrxycos(__pyx_v_frequency, 0, &__pyx_t_2)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2747, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("pysndlib.clm.make_nrxycos", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_codeobj__358 = (PyObject*)__Pyx_PyCode_New(4, 0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__352, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_make_nrxycos, 2747, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__358)) __PYX_ERR(0, 2747, __pyx_L1_error)
/* … */
__pyx_t_43 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_247make_nrxycos, 0, __pyx_n_s_make_nrxycos, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__358)); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 2747, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
__Pyx_CyFunction_SetDefaultsTuple(__pyx_t_43, __pyx_tuple__359);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_make_nrxycos, __pyx_t_43) < 0) __PYX_ERR(0, 2747, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
__pyx_tuple__359 = PyTuple_Pack(3, __pyx_float_1_, __pyx_int_1, __pyx_float__5); if (unlikely(!__pyx_tuple__359)) __PYX_ERR(0, 2747, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__359);
__Pyx_GIVEREF(__pyx_tuple__359);
/* … */
struct __pyx_opt_args_8pysndlib_3clm_make_nrxycos {
int __pyx_n;
double ratio;
int n;
double r;
};
2748: """
2749: return a new nrxycos generator.
2750:
2751: :param frequency: frequency of generator
2752: :param ratio: ratio between frequency and the spacing between successive sidebands
2753: :param n: number of sidebands
2754: :param r: amplitude ratio between successive sidebands (-1.0 < r < 1.0)
2755: :return: nrxycos gen
2756: :rtype: mus_any
2757: """
2758:
+2759: check_range('frequency', frequency, 0.0, get_srate() / 2)
__pyx_t_1 = PyFloat_FromDouble(__pyx_v_frequency); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2759, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __pyx_f_8pysndlib_3clm_get_srate(0); if (unlikely(__pyx_t_2 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2759, __pyx_L1_error) __pyx_t_3 = PyFloat_FromDouble((__pyx_t_2 / 2.0)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2759, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_5.__pyx_n = 2; __pyx_t_5.low = __pyx_float_0_0; __pyx_t_5.high = __pyx_t_3; __pyx_t_4 = __pyx_f_8pysndlib_3clm_check_range(__pyx_n_s_frequency, __pyx_t_1, 0, &__pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2759, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+2760: check_range('r', r, -1.0, 1.0)
__pyx_t_4 = PyFloat_FromDouble(__pyx_v_r); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2760, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5.__pyx_n = 2; __pyx_t_5.low = __pyx_float_neg_1_0; __pyx_t_5.high = __pyx_float_1_0; __pyx_t_3 = __pyx_f_8pysndlib_3clm_check_range(__pyx_n_s_r, __pyx_t_4, 0, &__pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2760, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+2761: check_range('n', n, 0, None)
__pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_n); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2761, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_5.__pyx_n = 2; __pyx_t_5.low = __pyx_int_0; __pyx_t_5.high = Py_None; __pyx_t_4 = __pyx_f_8pysndlib_3clm_check_range(__pyx_n_s_n, __pyx_t_3, 0, &__pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2761, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
2762:
+2763: return mus_any.from_ptr(cclm.mus_make_nrxycos(frequency, ratio, n, r))
__Pyx_XDECREF((PyObject *)__pyx_r); __pyx_t_4 = ((PyObject *)__pyx_vtabptr_8pysndlib_3clm_mus_any->from_ptr(mus_make_nrxycos(__pyx_v_frequency, __pyx_v_ratio, __pyx_v_n, __pyx_v_r), NULL)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2763, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_r = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_t_4); __pyx_t_4 = 0; goto __pyx_L0;
2764:
+2765: cpdef cython.double nrxycos(mus_any gen, cython.double fm=0.):
static PyObject *__pyx_pw_8pysndlib_3clm_249nrxycos(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static double __pyx_f_8pysndlib_3clm_nrxycos(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_8pysndlib_3clm_nrxycos *__pyx_optional_args) {
double __pyx_v_fm = ((double)0.);
double __pyx_r;
if (__pyx_optional_args) {
if (__pyx_optional_args->__pyx_n > 0) {
__pyx_v_fm = __pyx_optional_args->fm;
}
}
/* … */
/* function exit code */
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_249nrxycos(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_248nrxycos, "\n next sample of nrxycos generator.\n \n :param gen: ncos gen\n :param fm: fm input\n :rtype: float\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_249nrxycos = {"nrxycos", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_249nrxycos, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_248nrxycos};
static PyObject *__pyx_pw_8pysndlib_3clm_249nrxycos(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = 0;
double __pyx_v_fm;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("nrxycos (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gen,&__pyx_n_s_fm,0};
PyObject* values[2] = {0,0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_gen)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2765, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_fm);
if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2765, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "nrxycos") < 0)) __PYX_ERR(0, 2765, __pyx_L3_error)
}
} else {
switch (__pyx_nargs) {
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
break;
default: goto __pyx_L5_argtuple_error;
}
}
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)values[0]);
if (values[1]) {
__pyx_v_fm = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_fm == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2765, __pyx_L3_error)
} else {
__pyx_v_fm = ((double)0.);
}
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("nrxycos", 0, 1, 2, __pyx_nargs); __PYX_ERR(0, 2765, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.nrxycos", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gen), __pyx_ptype_8pysndlib_3clm_mus_any, 1, "gen", 0))) __PYX_ERR(0, 2765, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_248nrxycos(__pyx_self, __pyx_v_gen, __pyx_v_fm);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_248nrxycos(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, double __pyx_v_fm) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_2.__pyx_n = 1;
__pyx_t_2.fm = __pyx_v_fm;
__pyx_t_1 = __pyx_f_8pysndlib_3clm_nrxycos(__pyx_v_gen, 0, &__pyx_t_2); if (unlikely(__pyx_t_1 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2765, __pyx_L1_error)
__pyx_t_3 = PyFloat_FromDouble(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2765, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__pyx_r = __pyx_t_3;
__pyx_t_3 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_3);
__Pyx_AddTraceback("pysndlib.clm.nrxycos", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_codeobj__360 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__291, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_nrxycos, 2765, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__360)) __PYX_ERR(0, 2765, __pyx_L1_error)
/* … */
__pyx_t_43 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_249nrxycos, 0, __pyx_n_s_nrxycos, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__360)); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 2765, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
__Pyx_CyFunction_SetDefaultsTuple(__pyx_t_43, __pyx_tuple__361);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_nrxycos, __pyx_t_43) < 0) __PYX_ERR(0, 2765, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
__pyx_tuple__361 = PyTuple_Pack(1, __pyx_float_0_); if (unlikely(!__pyx_tuple__361)) __PYX_ERR(0, 2765, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__361);
__Pyx_GIVEREF(__pyx_tuple__361);
2766: """
2767: next sample of nrxycos generator.
2768:
2769: :param gen: ncos gen
2770: :param fm: fm input
2771: :rtype: float
2772: """
+2773: return cclm.mus_nrxycos(gen._ptr, fm)
__pyx_r = mus_nrxycos(__pyx_v_gen->_ptr, __pyx_v_fm); goto __pyx_L0;
2774:
+2775: cpdef bint is_nrxycos(mus_any gen):
static PyObject *__pyx_pw_8pysndlib_3clm_251is_nrxycos(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static int __pyx_f_8pysndlib_3clm_is_nrxycos(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, CYTHON_UNUSED int __pyx_skip_dispatch) {
int __pyx_r;
/* … */
/* function exit code */
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_251is_nrxycos(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_250is_nrxycos, "\n returns True if gen is a nrxycos.\n \n :param gen: gen\n :rtype: bool\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_251is_nrxycos = {"is_nrxycos", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_251is_nrxycos, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_250is_nrxycos};
static PyObject *__pyx_pw_8pysndlib_3clm_251is_nrxycos(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("is_nrxycos (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gen,0};
PyObject* values[1] = {0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_gen)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2775, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "is_nrxycos") < 0)) __PYX_ERR(0, 2775, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 1)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
}
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)values[0]);
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("is_nrxycos", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 2775, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.is_nrxycos", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gen), __pyx_ptype_8pysndlib_3clm_mus_any, 1, "gen", 0))) __PYX_ERR(0, 2775, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_250is_nrxycos(__pyx_self, __pyx_v_gen);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_250is_nrxycos(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8pysndlib_3clm_is_nrxycos(__pyx_v_gen, 0); if (unlikely(__pyx_t_1 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2775, __pyx_L1_error)
__pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2775, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("pysndlib.clm.is_nrxycos", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_43 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_251is_nrxycos, 0, __pyx_n_s_is_nrxycos, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__362)); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 2775, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_is_nrxycos, __pyx_t_43) < 0) __PYX_ERR(0, 2775, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
/* … */
__pyx_codeobj__362 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__56, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_is_nrxycos, 2775, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__362)) __PYX_ERR(0, 2775, __pyx_L1_error)
2776: """
2777: returns True if gen is a nrxycos.
2778:
2779: :param gen: gen
2780: :rtype: bool
2781: """
+2782: return cclm.mus_is_nrxycos(gen._ptr)
__pyx_r = mus_is_nrxycos(__pyx_v_gen->_ptr); goto __pyx_L0;
2783:
2784:
2785: # ---------------- rxykcos and rxyksin ---------------- #
+2786: cpdef mus_any make_rxykcos(cython.double frequency, cython.double phase=0.0, cython.double r=.5, cython.double ratio=1.):
static PyObject *__pyx_pw_8pysndlib_3clm_253make_rxykcos(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_f_8pysndlib_3clm_make_rxykcos(double __pyx_v_frequency, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_8pysndlib_3clm_make_rxykcos *__pyx_optional_args) {
double __pyx_v_phase = ((double)0.0);
double __pyx_v_r = ((double).5);
double __pyx_v_ratio = ((double)1.);
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_r = NULL;
if (__pyx_optional_args) {
if (__pyx_optional_args->__pyx_n > 0) {
__pyx_v_phase = __pyx_optional_args->phase;
if (__pyx_optional_args->__pyx_n > 1) {
__pyx_v_r = __pyx_optional_args->r;
if (__pyx_optional_args->__pyx_n > 2) {
__pyx_v_ratio = __pyx_optional_args->ratio;
}
}
}
}
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_AddTraceback("pysndlib.clm.make_rxykcos", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XGIVEREF((PyObject *)__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_253make_rxykcos(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_252make_rxykcos, "\n return a new rxykcos generator.\n \n :param frequency: frequency of generator\n :param ratio: ratio between frequency and the spacing between successive sidebands\n :param r: amplitude ratio between successive sidebands (-1.0 < r < 1.0)\n :return: rxykcos gen\n :rtype: mus_any\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_253make_rxykcos = {"make_rxykcos", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_253make_rxykcos, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_252make_rxykcos};
static PyObject *__pyx_pw_8pysndlib_3clm_253make_rxykcos(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
double __pyx_v_frequency;
double __pyx_v_phase;
double __pyx_v_r;
double __pyx_v_ratio;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("make_rxykcos (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_frequency,&__pyx_n_s_phase,&__pyx_n_s_r,&__pyx_n_s_ratio,0};
PyObject* values[4] = {0,0,0,0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
CYTHON_FALLTHROUGH;
case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_frequency)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2786, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_phase);
if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2786, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 2:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_r);
if (value) { values[2] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2786, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 3:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_ratio);
if (value) { values[3] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2786, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "make_rxykcos") < 0)) __PYX_ERR(0, 2786, __pyx_L3_error)
}
} else {
switch (__pyx_nargs) {
case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
CYTHON_FALLTHROUGH;
case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
break;
default: goto __pyx_L5_argtuple_error;
}
}
__pyx_v_frequency = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_frequency == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2786, __pyx_L3_error)
if (values[1]) {
__pyx_v_phase = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_phase == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2786, __pyx_L3_error)
} else {
__pyx_v_phase = ((double)0.0);
}
if (values[2]) {
__pyx_v_r = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_r == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2786, __pyx_L3_error)
} else {
__pyx_v_r = ((double).5);
}
if (values[3]) {
__pyx_v_ratio = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_ratio == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2786, __pyx_L3_error)
} else {
__pyx_v_ratio = ((double)1.);
}
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("make_rxykcos", 0, 1, 4, __pyx_nargs); __PYX_ERR(0, 2786, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.make_rxykcos", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_8pysndlib_3clm_252make_rxykcos(__pyx_self, __pyx_v_frequency, __pyx_v_phase, __pyx_v_r, __pyx_v_ratio);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_252make_rxykcos(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_frequency, double __pyx_v_phase, double __pyx_v_r, double __pyx_v_ratio) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_2.__pyx_n = 3;
__pyx_t_2.phase = __pyx_v_phase;
__pyx_t_2.r = __pyx_v_r;
__pyx_t_2.ratio = __pyx_v_ratio;
__pyx_t_1 = ((PyObject *)__pyx_f_8pysndlib_3clm_make_rxykcos(__pyx_v_frequency, 0, &__pyx_t_2)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2786, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("pysndlib.clm.make_rxykcos", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_tuple__363 = PyTuple_Pack(4, __pyx_n_s_frequency, __pyx_n_s_phase, __pyx_n_s_r, __pyx_n_s_ratio); if (unlikely(!__pyx_tuple__363)) __PYX_ERR(0, 2786, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__363);
__Pyx_GIVEREF(__pyx_tuple__363);
__pyx_codeobj__364 = (PyObject*)__Pyx_PyCode_New(4, 0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__363, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_make_rxykcos, 2786, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__364)) __PYX_ERR(0, 2786, __pyx_L1_error)
/* … */
__pyx_t_43 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_253make_rxykcos, 0, __pyx_n_s_make_rxykcos, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__364)); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 2786, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
__Pyx_CyFunction_SetDefaultsTuple(__pyx_t_43, __pyx_tuple__365);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_make_rxykcos, __pyx_t_43) < 0) __PYX_ERR(0, 2786, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
__pyx_tuple__365 = PyTuple_Pack(3, __pyx_float_0_0, __pyx_float__5, __pyx_float_1_); if (unlikely(!__pyx_tuple__365)) __PYX_ERR(0, 2786, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__365);
__Pyx_GIVEREF(__pyx_tuple__365);
/* … */
struct __pyx_opt_args_8pysndlib_3clm_make_rxykcos {
int __pyx_n;
double phase;
double r;
double ratio;
};
2787: """
2788: return a new rxykcos generator.
2789:
2790: :param frequency: frequency of generator
2791: :param ratio: ratio between frequency and the spacing between successive sidebands
2792: :param r: amplitude ratio between successive sidebands (-1.0 < r < 1.0)
2793: :return: rxykcos gen
2794: :rtype: mus_any
2795: """
+2796: check_range('frequency', frequency, 0.0, get_srate() / 2)
__pyx_t_1 = PyFloat_FromDouble(__pyx_v_frequency); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2796, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __pyx_f_8pysndlib_3clm_get_srate(0); if (unlikely(__pyx_t_2 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2796, __pyx_L1_error) __pyx_t_3 = PyFloat_FromDouble((__pyx_t_2 / 2.0)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2796, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_5.__pyx_n = 2; __pyx_t_5.low = __pyx_float_0_0; __pyx_t_5.high = __pyx_t_3; __pyx_t_4 = __pyx_f_8pysndlib_3clm_check_range(__pyx_n_s_frequency, __pyx_t_1, 0, &__pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2796, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+2797: check_range('r', r, -1.0, 1.0)
__pyx_t_4 = PyFloat_FromDouble(__pyx_v_r); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2797, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5.__pyx_n = 2; __pyx_t_5.low = __pyx_float_neg_1_0; __pyx_t_5.high = __pyx_float_1_0; __pyx_t_3 = __pyx_f_8pysndlib_3clm_check_range(__pyx_n_s_r, __pyx_t_4, 0, &__pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2797, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
2798:
+2799: return mus_any.from_ptr(cclm.mus_make_rxykcos(frequency, phase, r, ratio))
__Pyx_XDECREF((PyObject *)__pyx_r); __pyx_t_3 = ((PyObject *)__pyx_vtabptr_8pysndlib_3clm_mus_any->from_ptr(mus_make_rxykcos(__pyx_v_frequency, __pyx_v_phase, __pyx_v_r, __pyx_v_ratio), NULL)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2799, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_r = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_t_3); __pyx_t_3 = 0; goto __pyx_L0;
2800:
+2801: cpdef cython.double rxykcos(mus_any gen, cython.double fm=0.):
static PyObject *__pyx_pw_8pysndlib_3clm_255rxykcos(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static double __pyx_f_8pysndlib_3clm_rxykcos(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_8pysndlib_3clm_rxykcos *__pyx_optional_args) {
double __pyx_v_fm = ((double)0.);
double __pyx_r;
if (__pyx_optional_args) {
if (__pyx_optional_args->__pyx_n > 0) {
__pyx_v_fm = __pyx_optional_args->fm;
}
}
/* … */
/* function exit code */
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_255rxykcos(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_254rxykcos, "\n next sample of rxykcos generator.\n \n :param gen: rxykcos gen\n :param fm: fm input\n :rtype: float\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_255rxykcos = {"rxykcos", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_255rxykcos, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_254rxykcos};
static PyObject *__pyx_pw_8pysndlib_3clm_255rxykcos(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = 0;
double __pyx_v_fm;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("rxykcos (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gen,&__pyx_n_s_fm,0};
PyObject* values[2] = {0,0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_gen)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2801, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_fm);
if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2801, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "rxykcos") < 0)) __PYX_ERR(0, 2801, __pyx_L3_error)
}
} else {
switch (__pyx_nargs) {
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
break;
default: goto __pyx_L5_argtuple_error;
}
}
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)values[0]);
if (values[1]) {
__pyx_v_fm = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_fm == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2801, __pyx_L3_error)
} else {
__pyx_v_fm = ((double)0.);
}
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("rxykcos", 0, 1, 2, __pyx_nargs); __PYX_ERR(0, 2801, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.rxykcos", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gen), __pyx_ptype_8pysndlib_3clm_mus_any, 1, "gen", 0))) __PYX_ERR(0, 2801, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_254rxykcos(__pyx_self, __pyx_v_gen, __pyx_v_fm);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_254rxykcos(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, double __pyx_v_fm) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_2.__pyx_n = 1;
__pyx_t_2.fm = __pyx_v_fm;
__pyx_t_1 = __pyx_f_8pysndlib_3clm_rxykcos(__pyx_v_gen, 0, &__pyx_t_2); if (unlikely(__pyx_t_1 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2801, __pyx_L1_error)
__pyx_t_3 = PyFloat_FromDouble(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2801, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__pyx_r = __pyx_t_3;
__pyx_t_3 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_3);
__Pyx_AddTraceback("pysndlib.clm.rxykcos", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_codeobj__366 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__291, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_rxykcos, 2801, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__366)) __PYX_ERR(0, 2801, __pyx_L1_error)
/* … */
__pyx_t_43 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_255rxykcos, 0, __pyx_n_s_rxykcos, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__366)); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 2801, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
__Pyx_CyFunction_SetDefaultsTuple(__pyx_t_43, __pyx_tuple__367);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_rxykcos, __pyx_t_43) < 0) __PYX_ERR(0, 2801, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
__pyx_tuple__367 = PyTuple_Pack(1, __pyx_float_0_); if (unlikely(!__pyx_tuple__367)) __PYX_ERR(0, 2801, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__367);
__Pyx_GIVEREF(__pyx_tuple__367);
2802: """
2803: next sample of rxykcos generator.
2804:
2805: :param gen: rxykcos gen
2806: :param fm: fm input
2807: :rtype: float
2808: """
+2809: return cclm.mus_rxykcos(gen._ptr, fm)
__pyx_r = mus_rxykcos(__pyx_v_gen->_ptr, __pyx_v_fm); goto __pyx_L0;
2810:
+2811: cpdef bint is_rxykcos(gen: mus_any):
static PyObject *__pyx_pw_8pysndlib_3clm_257is_rxykcos(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static int __pyx_f_8pysndlib_3clm_is_rxykcos(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, CYTHON_UNUSED int __pyx_skip_dispatch) {
int __pyx_r;
/* … */
/* function exit code */
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_257is_rxykcos(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_256is_rxykcos, "\n returns True if gen is a rxykcos.\n \n :param gen: gen\n :rtype: bool\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_257is_rxykcos = {"is_rxykcos", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_257is_rxykcos, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_256is_rxykcos};
static PyObject *__pyx_pw_8pysndlib_3clm_257is_rxykcos(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("is_rxykcos (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gen,0};
PyObject* values[1] = {0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_gen)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2811, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "is_rxykcos") < 0)) __PYX_ERR(0, 2811, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 1)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
}
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)values[0]);
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("is_rxykcos", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 2811, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.is_rxykcos", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gen), __pyx_ptype_8pysndlib_3clm_mus_any, 0, "gen", 0))) __PYX_ERR(0, 2811, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_256is_rxykcos(__pyx_self, __pyx_v_gen);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_256is_rxykcos(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8pysndlib_3clm_is_rxykcos(__pyx_v_gen, 0); if (unlikely(__pyx_t_1 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2811, __pyx_L1_error)
__pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2811, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("pysndlib.clm.is_rxykcos", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_43 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 2811, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
if (PyDict_SetItem(__pyx_t_43, __pyx_n_s_gen, __pyx_n_s_mus_any) < 0) __PYX_ERR(0, 2811, __pyx_L1_error)
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_257is_rxykcos, 0, __pyx_n_s_is_rxykcos, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__368)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 2811, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
__Pyx_CyFunction_SetAnnotationsDict(__pyx_t_40, __pyx_t_43);
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
if (PyDict_SetItem(__pyx_d, __pyx_n_s_is_rxykcos, __pyx_t_40) < 0) __PYX_ERR(0, 2811, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
/* … */
__pyx_codeobj__368 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__56, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_is_rxykcos, 2811, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__368)) __PYX_ERR(0, 2811, __pyx_L1_error)
2812: """
2813: returns True if gen is a rxykcos.
2814:
2815: :param gen: gen
2816: :rtype: bool
2817: """
+2818: return cclm.mus_is_rxykcos(gen._ptr)
__pyx_r = mus_is_rxykcos(__pyx_v_gen->_ptr); goto __pyx_L0;
2819:
+2820: cpdef mus_any make_rxyksin(cython.double frequency, cython.double phase, cython.double r=.5, cython.double ratio=1.):
static PyObject *__pyx_pw_8pysndlib_3clm_259make_rxyksin(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_f_8pysndlib_3clm_make_rxyksin(double __pyx_v_frequency, double __pyx_v_phase, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_8pysndlib_3clm_make_rxyksin *__pyx_optional_args) {
double __pyx_v_r = ((double).5);
double __pyx_v_ratio = ((double)1.);
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_r = NULL;
if (__pyx_optional_args) {
if (__pyx_optional_args->__pyx_n > 0) {
__pyx_v_r = __pyx_optional_args->r;
if (__pyx_optional_args->__pyx_n > 1) {
__pyx_v_ratio = __pyx_optional_args->ratio;
}
}
}
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_AddTraceback("pysndlib.clm.make_rxyksin", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XGIVEREF((PyObject *)__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_259make_rxyksin(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_258make_rxyksin, "\n return a new rxyksin generator.\n \n :param frequency: frequency of generator\n :param ratio: ratio between frequency and the spacing between successive sidebands\n :param r: amplitude ratio between successive sidebands (-1.0 < r < 1.0)\n :return: rxyksin gen\n :rtype: mus_any\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_259make_rxyksin = {"make_rxyksin", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_259make_rxyksin, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_258make_rxyksin};
static PyObject *__pyx_pw_8pysndlib_3clm_259make_rxyksin(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
double __pyx_v_frequency;
double __pyx_v_phase;
double __pyx_v_r;
double __pyx_v_ratio;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("make_rxyksin (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_frequency,&__pyx_n_s_phase,&__pyx_n_s_r,&__pyx_n_s_ratio,0};
PyObject* values[4] = {0,0,0,0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
CYTHON_FALLTHROUGH;
case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_frequency)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2820, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_phase)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2820, __pyx_L3_error)
else {
__Pyx_RaiseArgtupleInvalid("make_rxyksin", 0, 2, 4, 1); __PYX_ERR(0, 2820, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 2:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_r);
if (value) { values[2] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2820, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 3:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_ratio);
if (value) { values[3] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2820, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "make_rxyksin") < 0)) __PYX_ERR(0, 2820, __pyx_L3_error)
}
} else {
switch (__pyx_nargs) {
case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
CYTHON_FALLTHROUGH;
case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
break;
default: goto __pyx_L5_argtuple_error;
}
}
__pyx_v_frequency = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_frequency == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2820, __pyx_L3_error)
__pyx_v_phase = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_phase == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2820, __pyx_L3_error)
if (values[2]) {
__pyx_v_r = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_r == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2820, __pyx_L3_error)
} else {
__pyx_v_r = ((double).5);
}
if (values[3]) {
__pyx_v_ratio = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_ratio == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2820, __pyx_L3_error)
} else {
__pyx_v_ratio = ((double)1.);
}
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("make_rxyksin", 0, 2, 4, __pyx_nargs); __PYX_ERR(0, 2820, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.make_rxyksin", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_8pysndlib_3clm_258make_rxyksin(__pyx_self, __pyx_v_frequency, __pyx_v_phase, __pyx_v_r, __pyx_v_ratio);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_258make_rxyksin(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_frequency, double __pyx_v_phase, double __pyx_v_r, double __pyx_v_ratio) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_2.__pyx_n = 2;
__pyx_t_2.r = __pyx_v_r;
__pyx_t_2.ratio = __pyx_v_ratio;
__pyx_t_1 = ((PyObject *)__pyx_f_8pysndlib_3clm_make_rxyksin(__pyx_v_frequency, __pyx_v_phase, 0, &__pyx_t_2)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2820, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("pysndlib.clm.make_rxyksin", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_codeobj__369 = (PyObject*)__Pyx_PyCode_New(4, 0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__363, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_make_rxyksin, 2820, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__369)) __PYX_ERR(0, 2820, __pyx_L1_error)
/* … */
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_259make_rxyksin, 0, __pyx_n_s_make_rxyksin, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__369)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 2820, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
__Pyx_CyFunction_SetDefaultsTuple(__pyx_t_40, __pyx_tuple__370);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_make_rxyksin, __pyx_t_40) < 0) __PYX_ERR(0, 2820, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
__pyx_tuple__370 = PyTuple_Pack(2, __pyx_float__5, __pyx_float_1_); if (unlikely(!__pyx_tuple__370)) __PYX_ERR(0, 2820, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__370);
__Pyx_GIVEREF(__pyx_tuple__370);
/* … */
struct __pyx_opt_args_8pysndlib_3clm_make_rxyksin {
int __pyx_n;
double r;
double ratio;
};
2821: """
2822: return a new rxyksin generator.
2823:
2824: :param frequency: frequency of generator
2825: :param ratio: ratio between frequency and the spacing between successive sidebands
2826: :param r: amplitude ratio between successive sidebands (-1.0 < r < 1.0)
2827: :return: rxyksin gen
2828: :rtype: mus_any
2829: """
+2830: check_range('frequency', frequency, 0.0, get_srate() / 2)
__pyx_t_1 = PyFloat_FromDouble(__pyx_v_frequency); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2830, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __pyx_f_8pysndlib_3clm_get_srate(0); if (unlikely(__pyx_t_2 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2830, __pyx_L1_error) __pyx_t_3 = PyFloat_FromDouble((__pyx_t_2 / 2.0)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2830, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_5.__pyx_n = 2; __pyx_t_5.low = __pyx_float_0_0; __pyx_t_5.high = __pyx_t_3; __pyx_t_4 = __pyx_f_8pysndlib_3clm_check_range(__pyx_n_s_frequency, __pyx_t_1, 0, &__pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2830, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+2831: check_range('r', r, -1.0, 1.0)
__pyx_t_4 = PyFloat_FromDouble(__pyx_v_r); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2831, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5.__pyx_n = 2; __pyx_t_5.low = __pyx_float_neg_1_0; __pyx_t_5.high = __pyx_float_1_0; __pyx_t_3 = __pyx_f_8pysndlib_3clm_check_range(__pyx_n_s_r, __pyx_t_4, 0, &__pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2831, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
2832:
+2833: return mus_any.from_ptr(cclm.mus_make_rxyksin(frequency, phase, r, ratio))
__Pyx_XDECREF((PyObject *)__pyx_r); __pyx_t_3 = ((PyObject *)__pyx_vtabptr_8pysndlib_3clm_mus_any->from_ptr(mus_make_rxyksin(__pyx_v_frequency, __pyx_v_phase, __pyx_v_r, __pyx_v_ratio), NULL)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2833, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_r = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_t_3); __pyx_t_3 = 0; goto __pyx_L0;
2834:
+2835: cpdef cython.double rxyksin(mus_any gen, cython.double fm=0.):
static PyObject *__pyx_pw_8pysndlib_3clm_261rxyksin(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static double __pyx_f_8pysndlib_3clm_rxyksin(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_8pysndlib_3clm_rxyksin *__pyx_optional_args) {
double __pyx_v_fm = ((double)0.);
double __pyx_r;
if (__pyx_optional_args) {
if (__pyx_optional_args->__pyx_n > 0) {
__pyx_v_fm = __pyx_optional_args->fm;
}
}
/* … */
/* function exit code */
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_261rxyksin(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_260rxyksin, "\n next sample of rxyksin generator.\n \n :param gen: rxyksin gen\n :param fm: fm input\n :rtype: float\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_261rxyksin = {"rxyksin", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_261rxyksin, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_260rxyksin};
static PyObject *__pyx_pw_8pysndlib_3clm_261rxyksin(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = 0;
double __pyx_v_fm;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("rxyksin (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gen,&__pyx_n_s_fm,0};
PyObject* values[2] = {0,0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_gen)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2835, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_fm);
if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2835, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "rxyksin") < 0)) __PYX_ERR(0, 2835, __pyx_L3_error)
}
} else {
switch (__pyx_nargs) {
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
break;
default: goto __pyx_L5_argtuple_error;
}
}
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)values[0]);
if (values[1]) {
__pyx_v_fm = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_fm == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2835, __pyx_L3_error)
} else {
__pyx_v_fm = ((double)0.);
}
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("rxyksin", 0, 1, 2, __pyx_nargs); __PYX_ERR(0, 2835, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.rxyksin", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gen), __pyx_ptype_8pysndlib_3clm_mus_any, 1, "gen", 0))) __PYX_ERR(0, 2835, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_260rxyksin(__pyx_self, __pyx_v_gen, __pyx_v_fm);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_260rxyksin(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, double __pyx_v_fm) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_2.__pyx_n = 1;
__pyx_t_2.fm = __pyx_v_fm;
__pyx_t_1 = __pyx_f_8pysndlib_3clm_rxyksin(__pyx_v_gen, 0, &__pyx_t_2); if (unlikely(__pyx_t_1 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2835, __pyx_L1_error)
__pyx_t_3 = PyFloat_FromDouble(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2835, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__pyx_r = __pyx_t_3;
__pyx_t_3 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_3);
__Pyx_AddTraceback("pysndlib.clm.rxyksin", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_codeobj__371 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__291, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_rxyksin, 2835, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__371)) __PYX_ERR(0, 2835, __pyx_L1_error)
/* … */
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_261rxyksin, 0, __pyx_n_s_rxyksin, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__371)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 2835, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
__Pyx_CyFunction_SetDefaultsTuple(__pyx_t_40, __pyx_tuple__372);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_rxyksin, __pyx_t_40) < 0) __PYX_ERR(0, 2835, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
__pyx_tuple__372 = PyTuple_Pack(1, __pyx_float_0_); if (unlikely(!__pyx_tuple__372)) __PYX_ERR(0, 2835, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__372);
__Pyx_GIVEREF(__pyx_tuple__372);
2836: """
2837: next sample of rxyksin generator.
2838:
2839: :param gen: rxyksin gen
2840: :param fm: fm input
2841: :rtype: float
2842: """
+2843: return cclm.mus_rxyksin(gen._ptr, fm)
__pyx_r = mus_rxyksin(__pyx_v_gen->_ptr, __pyx_v_fm); goto __pyx_L0;
2844:
+2845: cpdef bint is_rxyksin(mus_any gen):
static PyObject *__pyx_pw_8pysndlib_3clm_263is_rxyksin(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static int __pyx_f_8pysndlib_3clm_is_rxyksin(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, CYTHON_UNUSED int __pyx_skip_dispatch) {
int __pyx_r;
/* … */
/* function exit code */
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_263is_rxyksin(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_262is_rxyksin, "\n returns True if gen is a rxyksin.\n \n :param gen: gen\n :rtype: bool\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_263is_rxyksin = {"is_rxyksin", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_263is_rxyksin, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_262is_rxyksin};
static PyObject *__pyx_pw_8pysndlib_3clm_263is_rxyksin(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("is_rxyksin (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gen,0};
PyObject* values[1] = {0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_gen)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2845, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "is_rxyksin") < 0)) __PYX_ERR(0, 2845, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 1)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
}
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)values[0]);
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("is_rxyksin", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 2845, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.is_rxyksin", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gen), __pyx_ptype_8pysndlib_3clm_mus_any, 1, "gen", 0))) __PYX_ERR(0, 2845, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_262is_rxyksin(__pyx_self, __pyx_v_gen);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_262is_rxyksin(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8pysndlib_3clm_is_rxyksin(__pyx_v_gen, 0); if (unlikely(__pyx_t_1 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2845, __pyx_L1_error)
__pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2845, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("pysndlib.clm.is_rxyksin", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_263is_rxyksin, 0, __pyx_n_s_is_rxyksin, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__373)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 2845, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_is_rxyksin, __pyx_t_40) < 0) __PYX_ERR(0, 2845, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
/* … */
__pyx_codeobj__373 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__56, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_is_rxyksin, 2845, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__373)) __PYX_ERR(0, 2845, __pyx_L1_error)
2846: """
2847: returns True if gen is a rxyksin.
2848:
2849: :param gen: gen
2850: :rtype: bool
2851: """
+2852: return cclm.mus_is_rxyksin(gen._ptr)
__pyx_r = mus_is_rxyksin(__pyx_v_gen->_ptr); goto __pyx_L0;
2853:
2854: # ---------------- ssb-am ---------------- #
+2855: cpdef mus_any make_ssb_am(cython.double frequency, cython.int order=40):
static PyObject *__pyx_pw_8pysndlib_3clm_265make_ssb_am(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_f_8pysndlib_3clm_make_ssb_am(double __pyx_v_frequency, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_8pysndlib_3clm_make_ssb_am *__pyx_optional_args) {
int __pyx_v_order = ((int)40);
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_r = NULL;
if (__pyx_optional_args) {
if (__pyx_optional_args->__pyx_n > 0) {
__pyx_v_order = __pyx_optional_args->order;
}
}
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_AddTraceback("pysndlib.clm.make_ssb_am", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XGIVEREF((PyObject *)__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_265make_ssb_am(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_264make_ssb_am, "\n return a new ssb_am generator.\n \n :param frequency: frequency of generator\n :param order: embedded delay line size\n :return: ssb_am gen\n :rtype: mus_any\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_265make_ssb_am = {"make_ssb_am", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_265make_ssb_am, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_264make_ssb_am};
static PyObject *__pyx_pw_8pysndlib_3clm_265make_ssb_am(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
double __pyx_v_frequency;
int __pyx_v_order;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("make_ssb_am (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_frequency,&__pyx_n_s_order,0};
PyObject* values[2] = {0,0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_frequency)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2855, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_order);
if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2855, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "make_ssb_am") < 0)) __PYX_ERR(0, 2855, __pyx_L3_error)
}
} else {
switch (__pyx_nargs) {
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
break;
default: goto __pyx_L5_argtuple_error;
}
}
__pyx_v_frequency = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_frequency == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2855, __pyx_L3_error)
if (values[1]) {
__pyx_v_order = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_order == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2855, __pyx_L3_error)
} else {
__pyx_v_order = ((int)40);
}
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("make_ssb_am", 0, 1, 2, __pyx_nargs); __PYX_ERR(0, 2855, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.make_ssb_am", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_8pysndlib_3clm_264make_ssb_am(__pyx_self, __pyx_v_frequency, __pyx_v_order);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_264make_ssb_am(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_frequency, int __pyx_v_order) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_2.__pyx_n = 1;
__pyx_t_2.order = __pyx_v_order;
__pyx_t_1 = ((PyObject *)__pyx_f_8pysndlib_3clm_make_ssb_am(__pyx_v_frequency, 0, &__pyx_t_2)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2855, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("pysndlib.clm.make_ssb_am", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_tuple__374 = PyTuple_Pack(2, __pyx_n_s_frequency, __pyx_n_s_order); if (unlikely(!__pyx_tuple__374)) __PYX_ERR(0, 2855, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__374);
__Pyx_GIVEREF(__pyx_tuple__374);
__pyx_codeobj__375 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__374, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_make_ssb_am, 2855, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__375)) __PYX_ERR(0, 2855, __pyx_L1_error)
/* … */
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_265make_ssb_am, 0, __pyx_n_s_make_ssb_am, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__375)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 2855, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
__Pyx_CyFunction_SetDefaultsTuple(__pyx_t_40, __pyx_tuple__376);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_make_ssb_am, __pyx_t_40) < 0) __PYX_ERR(0, 2855, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
__pyx_tuple__376 = PyTuple_Pack(1, __pyx_int_40); if (unlikely(!__pyx_tuple__376)) __PYX_ERR(0, 2855, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__376);
__Pyx_GIVEREF(__pyx_tuple__376);
/* … */
struct __pyx_opt_args_8pysndlib_3clm_make_ssb_am {
int __pyx_n;
int order;
};
2856: """
2857: return a new ssb_am generator.
2858:
2859: :param frequency: frequency of generator
2860: :param order: embedded delay line size
2861: :return: ssb_am gen
2862: :rtype: mus_any
2863: """
+2864: check_range('frequency', frequency, 0.0, get_srate() / 2)
__pyx_t_1 = PyFloat_FromDouble(__pyx_v_frequency); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2864, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __pyx_f_8pysndlib_3clm_get_srate(0); if (unlikely(__pyx_t_2 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2864, __pyx_L1_error) __pyx_t_3 = PyFloat_FromDouble((__pyx_t_2 / 2.0)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2864, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_5.__pyx_n = 2; __pyx_t_5.low = __pyx_float_0_0; __pyx_t_5.high = __pyx_t_3; __pyx_t_4 = __pyx_f_8pysndlib_3clm_check_range(__pyx_n_s_frequency, __pyx_t_1, 0, &__pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2864, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
2865:
+2866: return mus_any.from_ptr(cclm.mus_make_ssb_am(frequency, order))
__Pyx_XDECREF((PyObject *)__pyx_r); __pyx_t_4 = ((PyObject *)__pyx_vtabptr_8pysndlib_3clm_mus_any->from_ptr(mus_make_ssb_am(__pyx_v_frequency, __pyx_v_order), NULL)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2866, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_r = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_t_4); __pyx_t_4 = 0; goto __pyx_L0;
2867:
+2868: cpdef cython.double ssb_am(mus_any gen, cython.double insig , cython.double fm=0.0):
static PyObject *__pyx_pw_8pysndlib_3clm_267ssb_am(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static double __pyx_f_8pysndlib_3clm_ssb_am(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, double __pyx_v_insig, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_8pysndlib_3clm_ssb_am *__pyx_optional_args) {
double __pyx_v_fm = ((double)0.0);
double __pyx_r;
if (__pyx_optional_args) {
if (__pyx_optional_args->__pyx_n > 0) {
__pyx_v_fm = __pyx_optional_args->fm;
}
}
/* … */
/* function exit code */
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_267ssb_am(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_266ssb_am, "\n get the next sample from ssb_am generator.\n \n :param gen: ssb_am gen\n :param fm: fm input\n :rtype: float\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_267ssb_am = {"ssb_am", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_267ssb_am, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_266ssb_am};
static PyObject *__pyx_pw_8pysndlib_3clm_267ssb_am(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = 0;
double __pyx_v_insig;
double __pyx_v_fm;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("ssb_am (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gen,&__pyx_n_s_insig,&__pyx_n_s_fm,0};
PyObject* values[3] = {0,0,0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_gen)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2868, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_insig)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2868, __pyx_L3_error)
else {
__Pyx_RaiseArgtupleInvalid("ssb_am", 0, 2, 3, 1); __PYX_ERR(0, 2868, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 2:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_fm);
if (value) { values[2] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2868, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "ssb_am") < 0)) __PYX_ERR(0, 2868, __pyx_L3_error)
}
} else {
switch (__pyx_nargs) {
case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
break;
default: goto __pyx_L5_argtuple_error;
}
}
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)values[0]);
__pyx_v_insig = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_insig == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2868, __pyx_L3_error)
if (values[2]) {
__pyx_v_fm = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_fm == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2868, __pyx_L3_error)
} else {
__pyx_v_fm = ((double)0.0);
}
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("ssb_am", 0, 2, 3, __pyx_nargs); __PYX_ERR(0, 2868, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.ssb_am", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gen), __pyx_ptype_8pysndlib_3clm_mus_any, 1, "gen", 0))) __PYX_ERR(0, 2868, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_266ssb_am(__pyx_self, __pyx_v_gen, __pyx_v_insig, __pyx_v_fm);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_266ssb_am(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, double __pyx_v_insig, double __pyx_v_fm) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_2.__pyx_n = 1;
__pyx_t_2.fm = __pyx_v_fm;
__pyx_t_1 = __pyx_f_8pysndlib_3clm_ssb_am(__pyx_v_gen, __pyx_v_insig, 0, &__pyx_t_2); if (unlikely(__pyx_t_1 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2868, __pyx_L1_error)
__pyx_t_3 = PyFloat_FromDouble(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2868, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__pyx_r = __pyx_t_3;
__pyx_t_3 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_3);
__Pyx_AddTraceback("pysndlib.clm.ssb_am", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_tuple__377 = PyTuple_Pack(3, __pyx_n_s_gen, __pyx_n_s_insig, __pyx_n_s_fm); if (unlikely(!__pyx_tuple__377)) __PYX_ERR(0, 2868, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__377);
__Pyx_GIVEREF(__pyx_tuple__377);
__pyx_codeobj__378 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__377, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_ssb_am, 2868, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__378)) __PYX_ERR(0, 2868, __pyx_L1_error)
/* … */
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_267ssb_am, 0, __pyx_n_s_ssb_am, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__378)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 2868, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
__Pyx_CyFunction_SetDefaultsTuple(__pyx_t_40, __pyx_tuple__379);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_ssb_am, __pyx_t_40) < 0) __PYX_ERR(0, 2868, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
__pyx_tuple__379 = PyTuple_Pack(1, __pyx_float_0_0); if (unlikely(!__pyx_tuple__379)) __PYX_ERR(0, 2868, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__379);
__Pyx_GIVEREF(__pyx_tuple__379);
2869: """
2870: get the next sample from ssb_am generator.
2871:
2872: :param gen: ssb_am gen
2873: :param fm: fm input
2874: :rtype: float
2875: """
+2876: return cclm.mus_ssb_am(gen._ptr, insig, fm)
__pyx_r = mus_ssb_am(__pyx_v_gen->_ptr, __pyx_v_insig, __pyx_v_fm); goto __pyx_L0;
2877:
2878:
+2879: cpdef cython.double ssb_am_unmodulated(mus_any gen, cython.double insig):
static PyObject *__pyx_pw_8pysndlib_3clm_269ssb_am_unmodulated(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static double __pyx_f_8pysndlib_3clm_ssb_am_unmodulated(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, double __pyx_v_insig, CYTHON_UNUSED int __pyx_skip_dispatch) {
double __pyx_r;
/* … */
/* function exit code */
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_269ssb_am_unmodulated(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_268ssb_am_unmodulated, "\n get the next sample from ssb_am generator. unmodulated.\n \n :param gen: ssb_am gen\n :rtype: float\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_269ssb_am_unmodulated = {"ssb_am_unmodulated", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_269ssb_am_unmodulated, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_268ssb_am_unmodulated};
static PyObject *__pyx_pw_8pysndlib_3clm_269ssb_am_unmodulated(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = 0;
double __pyx_v_insig;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("ssb_am_unmodulated (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gen,&__pyx_n_s_insig,0};
PyObject* values[2] = {0,0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_gen)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2879, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_insig)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2879, __pyx_L3_error)
else {
__Pyx_RaiseArgtupleInvalid("ssb_am_unmodulated", 1, 2, 2, 1); __PYX_ERR(0, 2879, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "ssb_am_unmodulated") < 0)) __PYX_ERR(0, 2879, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 2)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
}
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)values[0]);
__pyx_v_insig = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_insig == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2879, __pyx_L3_error)
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("ssb_am_unmodulated", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 2879, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.ssb_am_unmodulated", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gen), __pyx_ptype_8pysndlib_3clm_mus_any, 1, "gen", 0))) __PYX_ERR(0, 2879, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_268ssb_am_unmodulated(__pyx_self, __pyx_v_gen, __pyx_v_insig);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_268ssb_am_unmodulated(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, double __pyx_v_insig) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8pysndlib_3clm_ssb_am_unmodulated(__pyx_v_gen, __pyx_v_insig, 0); if (unlikely(__pyx_t_1 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2879, __pyx_L1_error)
__pyx_t_2 = PyFloat_FromDouble(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2879, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("pysndlib.clm.ssb_am_unmodulated", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_tuple__380 = PyTuple_Pack(2, __pyx_n_s_gen, __pyx_n_s_insig); if (unlikely(!__pyx_tuple__380)) __PYX_ERR(0, 2879, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__380);
__Pyx_GIVEREF(__pyx_tuple__380);
/* … */
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_269ssb_am_unmodulated, 0, __pyx_n_s_ssb_am_unmodulated, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__381)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 2879, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_ssb_am_unmodulated, __pyx_t_40) < 0) __PYX_ERR(0, 2879, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
__pyx_codeobj__381 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__380, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_ssb_am_unmodulated, 2879, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__381)) __PYX_ERR(0, 2879, __pyx_L1_error)
2880: """
2881: get the next sample from ssb_am generator. unmodulated.
2882:
2883: :param gen: ssb_am gen
2884: :rtype: float
2885: """
+2886: return cclm.mus_ssb_am_unmodulated(gen._ptr, insig)
__pyx_r = mus_ssb_am_unmodulated(__pyx_v_gen->_ptr, __pyx_v_insig); goto __pyx_L0;
2887:
+2888: cpdef bint is_ssb_am(mus_any gen):
static PyObject *__pyx_pw_8pysndlib_3clm_271is_ssb_am(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static int __pyx_f_8pysndlib_3clm_is_ssb_am(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, CYTHON_UNUSED int __pyx_skip_dispatch) {
int __pyx_r;
/* … */
/* function exit code */
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_271is_ssb_am(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_270is_ssb_am, "\n returns True if gen is a ssb_am.\n \n :param gen: gen\n :rtype: bool\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_271is_ssb_am = {"is_ssb_am", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_271is_ssb_am, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_270is_ssb_am};
static PyObject *__pyx_pw_8pysndlib_3clm_271is_ssb_am(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("is_ssb_am (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gen,0};
PyObject* values[1] = {0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_gen)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2888, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "is_ssb_am") < 0)) __PYX_ERR(0, 2888, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 1)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
}
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)values[0]);
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("is_ssb_am", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 2888, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.is_ssb_am", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gen), __pyx_ptype_8pysndlib_3clm_mus_any, 1, "gen", 0))) __PYX_ERR(0, 2888, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_270is_ssb_am(__pyx_self, __pyx_v_gen);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_270is_ssb_am(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8pysndlib_3clm_is_ssb_am(__pyx_v_gen, 0); if (unlikely(__pyx_t_1 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2888, __pyx_L1_error)
__pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2888, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("pysndlib.clm.is_ssb_am", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_271is_ssb_am, 0, __pyx_n_s_is_ssb_am, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__382)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 2888, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_is_ssb_am, __pyx_t_40) < 0) __PYX_ERR(0, 2888, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
/* … */
__pyx_codeobj__382 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__56, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_is_ssb_am, 2888, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__382)) __PYX_ERR(0, 2888, __pyx_L1_error)
2889: """
2890: returns True if gen is a ssb_am.
2891:
2892: :param gen: gen
2893: :rtype: bool
2894: """
+2895: return cclm.mus_is_ssb_am(gen._ptr)
__pyx_r = mus_is_ssb_am(__pyx_v_gen->_ptr); goto __pyx_L0;
2896:
2897:
2898:
2899: # ---------------- wave-train ----------------#
+2900: cpdef mus_any make_wave_train(cython.double frequency, wave=None, cython.double initial_phase=0., Interp interp_type=Interp.LINEAR):
static PyObject *__pyx_pw_8pysndlib_3clm_273make_wave_train(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_f_8pysndlib_3clm_make_wave_train(double __pyx_v_frequency, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_8pysndlib_3clm_make_wave_train *__pyx_optional_args) {
PyObject *__pyx_v_wave = ((PyObject *)Py_None);
double __pyx_v_initial_phase = ((double)0.);
enum __pyx_t_8pysndlib_3clm_Interp __pyx_v_interp_type = __pyx_k__38;
__Pyx_memviewslice __pyx_v_wave_view = { 0, 0, { 0 }, { 0 }, { 0 } };
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = NULL;
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_r = NULL;
if (__pyx_optional_args) {
if (__pyx_optional_args->__pyx_n > 0) {
__pyx_v_wave = __pyx_optional_args->wave;
if (__pyx_optional_args->__pyx_n > 1) {
__pyx_v_initial_phase = __pyx_optional_args->initial_phase;
if (__pyx_optional_args->__pyx_n > 2) {
__pyx_v_interp_type = __pyx_optional_args->interp_type;
}
}
}
}
__Pyx_INCREF(__pyx_v_wave);
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__PYX_XCLEAR_MEMVIEW(&__pyx_t_8, 1);
__Pyx_AddTraceback("pysndlib.clm.make_wave_train", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__PYX_XCLEAR_MEMVIEW(&__pyx_v_wave_view, 1);
__Pyx_XDECREF((PyObject *)__pyx_v_gen);
__Pyx_XDECREF(__pyx_v_wave);
__Pyx_XGIVEREF((PyObject *)__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_273make_wave_train(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_272make_wave_train, "\n return a new wave-train generator (an extension of pulse-train). frequency is the repetition rate\n of the wave found \\in wave. successive waves can overlap.\n \n :param frequency: frequency of gen \\in hz\n :param wave: np.ndarray if provided is waveform\n :param initial_phase: initial phase of gen \\in radians\n :param interp_type: type of interpolation used\n :return: wave_train gen\n :rtype: mus_any\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_273make_wave_train = {"make_wave_train", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_273make_wave_train, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_272make_wave_train};
static PyObject *__pyx_pw_8pysndlib_3clm_273make_wave_train(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
double __pyx_v_frequency;
PyObject *__pyx_v_wave = 0;
double __pyx_v_initial_phase;
enum __pyx_t_8pysndlib_3clm_Interp __pyx_v_interp_type;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("make_wave_train (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_frequency,&__pyx_n_s_wave,&__pyx_n_s_initial_phase,&__pyx_n_s_interp_type,0};
PyObject* values[4] = {0,0,0,0};
values[1] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
CYTHON_FALLTHROUGH;
case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_frequency)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2900, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_wave);
if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2900, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 2:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_initial_phase);
if (value) { values[2] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2900, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 3:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_interp_type);
if (value) { values[3] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2900, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "make_wave_train") < 0)) __PYX_ERR(0, 2900, __pyx_L3_error)
}
} else {
switch (__pyx_nargs) {
case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
CYTHON_FALLTHROUGH;
case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
break;
default: goto __pyx_L5_argtuple_error;
}
}
__pyx_v_frequency = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_frequency == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2900, __pyx_L3_error)
__pyx_v_wave = values[1];
if (values[2]) {
__pyx_v_initial_phase = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_initial_phase == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2900, __pyx_L3_error)
} else {
__pyx_v_initial_phase = ((double)0.);
}
if (values[3]) {
__pyx_v_interp_type = ((enum __pyx_t_8pysndlib_3clm_Interp)__Pyx_PyInt_As_enum____pyx_t_8pysndlib_3clm_Interp(values[3])); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2900, __pyx_L3_error)
} else {
__pyx_v_interp_type = __pyx_k__38;
}
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("make_wave_train", 0, 1, 4, __pyx_nargs); __PYX_ERR(0, 2900, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.make_wave_train", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_8pysndlib_3clm_272make_wave_train(__pyx_self, __pyx_v_frequency, __pyx_v_wave, __pyx_v_initial_phase, __pyx_v_interp_type);
/* function exit code */
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_272make_wave_train(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_frequency, PyObject *__pyx_v_wave, double __pyx_v_initial_phase, enum __pyx_t_8pysndlib_3clm_Interp __pyx_v_interp_type) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_2.__pyx_n = 3;
__pyx_t_2.wave = __pyx_v_wave;
__pyx_t_2.initial_phase = __pyx_v_initial_phase;
__pyx_t_2.interp_type = __pyx_v_interp_type;
__pyx_t_1 = ((PyObject *)__pyx_f_8pysndlib_3clm_make_wave_train(__pyx_v_frequency, 0, &__pyx_t_2)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2900, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("pysndlib.clm.make_wave_train", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_k__38 = __pyx_e_8pysndlib_3clm_LINEAR;
/* … */
__pyx_tuple__383 = PyTuple_Pack(4, __pyx_n_s_frequency, __pyx_n_s_wave, __pyx_n_s_initial_phase, __pyx_n_s_interp_type); if (unlikely(!__pyx_tuple__383)) __PYX_ERR(0, 2900, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__383);
__Pyx_GIVEREF(__pyx_tuple__383);
__pyx_t_40 = __Pyx_Enum_Interp_to_py(__pyx_e_8pysndlib_3clm_LINEAR); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 2900, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
__pyx_t_43 = PyTuple_New(3); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 2900, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
__Pyx_INCREF(Py_None);
__Pyx_GIVEREF(Py_None);
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_43, 0, Py_None)) __PYX_ERR(0, 2900, __pyx_L1_error);
__Pyx_INCREF(__pyx_float_0_);
__Pyx_GIVEREF(__pyx_float_0_);
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_43, 1, __pyx_float_0_)) __PYX_ERR(0, 2900, __pyx_L1_error);
__Pyx_GIVEREF(__pyx_t_40);
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_43, 2, __pyx_t_40)) __PYX_ERR(0, 2900, __pyx_L1_error);
__pyx_t_40 = 0;
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_273make_wave_train, 0, __pyx_n_s_make_wave_train, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__384)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 2900, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
__Pyx_CyFunction_SetDefaultsTuple(__pyx_t_40, __pyx_t_43);
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
if (PyDict_SetItem(__pyx_d, __pyx_n_s_make_wave_train, __pyx_t_40) < 0) __PYX_ERR(0, 2900, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
__pyx_codeobj__384 = (PyObject*)__Pyx_PyCode_New(4, 0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__383, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_make_wave_train, 2900, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__384)) __PYX_ERR(0, 2900, __pyx_L1_error)
/* … */
struct __pyx_opt_args_8pysndlib_3clm_make_wave_train {
int __pyx_n;
PyObject *wave;
double initial_phase;
enum __pyx_t_8pysndlib_3clm_Interp interp_type;
};
2901: """
2902: return a new wave-train generator (an extension of pulse-train). frequency is the repetition rate
2903: of the wave found \in wave. successive waves can overlap.
2904:
2905: :param frequency: frequency of gen \in hz
2906: :param wave: np.ndarray if provided is waveform
2907: :param initial_phase: initial phase of gen \in radians
2908: :param interp_type: type of interpolation used
2909: :return: wave_train gen
2910: :rtype: mus_any
2911: """
+2912: if isinstance(wave, list):
__pyx_t_1 = PyList_Check(__pyx_v_wave);
if (__pyx_t_1) {
/* … */
}
+2913: wave = np.array(wave)
__Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2913, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_array); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2913, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = NULL; __pyx_t_5 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_4))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_4, function); __pyx_t_5 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v_wave}; __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2913, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } __Pyx_DECREF_SET(__pyx_v_wave, __pyx_t_2); __pyx_t_2 = 0;
2914:
+2915: check_ndim(wave)
__pyx_t_2 = __pyx_f_8pysndlib_3clm_check_ndim(__pyx_v_wave, 0, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2915, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+2916: check_range('frequency', frequency, 0.0, get_srate() / 2)
__pyx_t_2 = PyFloat_FromDouble(__pyx_v_frequency); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2916, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_6 = __pyx_f_8pysndlib_3clm_get_srate(0); if (unlikely(__pyx_t_6 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2916, __pyx_L1_error) __pyx_t_4 = PyFloat_FromDouble((__pyx_t_6 / 2.0)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2916, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_7.__pyx_n = 2; __pyx_t_7.low = __pyx_float_0_0; __pyx_t_7.high = __pyx_t_4; __pyx_t_3 = __pyx_f_8pysndlib_3clm_check_range(__pyx_n_s_frequency, __pyx_t_2, 0, &__pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2916, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
2917:
+2918: cdef double [:] wave_view = wave
__pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_v_wave, PyBUF_WRITABLE); if (unlikely(!__pyx_t_8.memview)) __PYX_ERR(0, 2918, __pyx_L1_error) __pyx_v_wave_view = __pyx_t_8; __pyx_t_8.memview = NULL; __pyx_t_8.data = NULL;
+2919: gen = mus_any.from_ptr(cclm.mus_make_wave_train(frequency, initial_phase, &wave_view[0], len(wave), <cclm.mus_interp_t>interp_type))
__pyx_t_9 = 0;
__pyx_t_5 = -1;
if (__pyx_t_9 < 0) {
__pyx_t_9 += __pyx_v_wave_view.shape[0];
if (unlikely(__pyx_t_9 < 0)) __pyx_t_5 = 0;
} else if (unlikely(__pyx_t_9 >= __pyx_v_wave_view.shape[0])) __pyx_t_5 = 0;
if (unlikely(__pyx_t_5 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_5);
__PYX_ERR(0, 2919, __pyx_L1_error)
}
__pyx_t_10 = PyObject_Length(__pyx_v_wave); if (unlikely(__pyx_t_10 == ((Py_ssize_t)-1))) __PYX_ERR(0, 2919, __pyx_L1_error)
__pyx_t_3 = ((PyObject *)__pyx_vtabptr_8pysndlib_3clm_mus_any->from_ptr(mus_make_wave_train(__pyx_v_frequency, __pyx_v_initial_phase, (&(*((double *) ( /* dim=0 */ (__pyx_v_wave_view.data + __pyx_t_9 * __pyx_v_wave_view.strides[0]) )))), __pyx_t_10, ((mus_interp_t)__pyx_v_interp_type)), NULL)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2919, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_t_3);
__pyx_t_3 = 0;
+2920: gen.cache_append(wave)
__pyx_t_3 = ((struct __pyx_vtabstruct_8pysndlib_3clm_mus_any *)__pyx_v_gen->__pyx_vtab)->cache_append(__pyx_v_gen, __pyx_v_wave, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2920, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+2921: return gen
__Pyx_XDECREF((PyObject *)__pyx_r); __Pyx_INCREF((PyObject *)__pyx_v_gen); __pyx_r = __pyx_v_gen; goto __pyx_L0;
2922:
+2923: cpdef cython.double wave_train(mus_any gen, cython.double fm=0.0):
static PyObject *__pyx_pw_8pysndlib_3clm_275wave_train(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static double __pyx_f_8pysndlib_3clm_wave_train(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_8pysndlib_3clm_wave_train *__pyx_optional_args) {
double __pyx_v_fm = ((double)0.0);
double __pyx_r;
if (__pyx_optional_args) {
if (__pyx_optional_args->__pyx_n > 0) {
__pyx_v_fm = __pyx_optional_args->fm;
}
}
/* … */
/* function exit code */
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_275wave_train(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_274wave_train, "\n next sample of wave_train.\n \n :param gen: wave_train gen\n :param fm: fm input\n :rtype: float\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_275wave_train = {"wave_train", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_275wave_train, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_274wave_train};
static PyObject *__pyx_pw_8pysndlib_3clm_275wave_train(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = 0;
double __pyx_v_fm;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("wave_train (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gen,&__pyx_n_s_fm,0};
PyObject* values[2] = {0,0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_gen)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2923, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_fm);
if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2923, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "wave_train") < 0)) __PYX_ERR(0, 2923, __pyx_L3_error)
}
} else {
switch (__pyx_nargs) {
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
break;
default: goto __pyx_L5_argtuple_error;
}
}
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)values[0]);
if (values[1]) {
__pyx_v_fm = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_fm == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2923, __pyx_L3_error)
} else {
__pyx_v_fm = ((double)0.0);
}
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("wave_train", 0, 1, 2, __pyx_nargs); __PYX_ERR(0, 2923, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.wave_train", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gen), __pyx_ptype_8pysndlib_3clm_mus_any, 1, "gen", 0))) __PYX_ERR(0, 2923, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_274wave_train(__pyx_self, __pyx_v_gen, __pyx_v_fm);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_274wave_train(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, double __pyx_v_fm) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_2.__pyx_n = 1;
__pyx_t_2.fm = __pyx_v_fm;
__pyx_t_1 = __pyx_f_8pysndlib_3clm_wave_train(__pyx_v_gen, 0, &__pyx_t_2); if (unlikely(__pyx_t_1 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2923, __pyx_L1_error)
__pyx_t_3 = PyFloat_FromDouble(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2923, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__pyx_r = __pyx_t_3;
__pyx_t_3 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_3);
__Pyx_AddTraceback("pysndlib.clm.wave_train", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_codeobj__385 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__291, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_wave_train, 2923, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__385)) __PYX_ERR(0, 2923, __pyx_L1_error)
/* … */
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_275wave_train, 0, __pyx_n_s_wave_train, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__385)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 2923, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
__Pyx_CyFunction_SetDefaultsTuple(__pyx_t_40, __pyx_tuple__386);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_wave_train, __pyx_t_40) < 0) __PYX_ERR(0, 2923, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
__pyx_tuple__386 = PyTuple_Pack(1, __pyx_float_0_0); if (unlikely(!__pyx_tuple__386)) __PYX_ERR(0, 2923, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__386);
__Pyx_GIVEREF(__pyx_tuple__386);
2924: """
2925: next sample of wave_train.
2926:
2927: :param gen: wave_train gen
2928: :param fm: fm input
2929: :rtype: float
2930: """
+2931: return cclm.mus_wave_train(gen._ptr, fm)
__pyx_r = mus_wave_train(__pyx_v_gen->_ptr, __pyx_v_fm); goto __pyx_L0;
2932:
2933:
+2934: cpdef cython.double wave_train_unmodulated(mus_any gen):
static PyObject *__pyx_pw_8pysndlib_3clm_277wave_train_unmodulated(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static double __pyx_f_8pysndlib_3clm_wave_train_unmodulated(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, CYTHON_UNUSED int __pyx_skip_dispatch) {
double __pyx_r;
/* … */
/* function exit code */
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_277wave_train_unmodulated(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_276wave_train_unmodulated, "\n next sample of wave_train. unmodulated\n \n :param gen: wave_train gen\n :rtype: float\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_277wave_train_unmodulated = {"wave_train_unmodulated", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_277wave_train_unmodulated, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_276wave_train_unmodulated};
static PyObject *__pyx_pw_8pysndlib_3clm_277wave_train_unmodulated(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("wave_train_unmodulated (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gen,0};
PyObject* values[1] = {0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_gen)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2934, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "wave_train_unmodulated") < 0)) __PYX_ERR(0, 2934, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 1)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
}
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)values[0]);
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("wave_train_unmodulated", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 2934, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.wave_train_unmodulated", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gen), __pyx_ptype_8pysndlib_3clm_mus_any, 1, "gen", 0))) __PYX_ERR(0, 2934, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_276wave_train_unmodulated(__pyx_self, __pyx_v_gen);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_276wave_train_unmodulated(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8pysndlib_3clm_wave_train_unmodulated(__pyx_v_gen, 0); if (unlikely(__pyx_t_1 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2934, __pyx_L1_error)
__pyx_t_2 = PyFloat_FromDouble(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2934, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("pysndlib.clm.wave_train_unmodulated", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_277wave_train_unmodulated, 0, __pyx_n_s_wave_train_unmodulated, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__387)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 2934, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_wave_train_unmodulated, __pyx_t_40) < 0) __PYX_ERR(0, 2934, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
/* … */
__pyx_codeobj__387 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__56, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_wave_train_unmodulated, 2934, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__387)) __PYX_ERR(0, 2934, __pyx_L1_error)
2935: """
2936: next sample of wave_train. unmodulated
2937:
2938: :param gen: wave_train gen
2939: :rtype: float
2940: """
+2941: return cclm.mus_wave_train_unmodulated(gen._ptr)
__pyx_r = mus_wave_train_unmodulated(__pyx_v_gen->_ptr); goto __pyx_L0;
2942:
+2943: cpdef bint is_wave_train(mus_any gen):
static PyObject *__pyx_pw_8pysndlib_3clm_279is_wave_train(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static int __pyx_f_8pysndlib_3clm_is_wave_train(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, CYTHON_UNUSED int __pyx_skip_dispatch) {
int __pyx_r;
/* … */
/* function exit code */
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_279is_wave_train(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_278is_wave_train, "\n returns True if gen is a wave_train.\n \n :param gen: gen\n :rtype: bool\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_279is_wave_train = {"is_wave_train", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_279is_wave_train, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_278is_wave_train};
static PyObject *__pyx_pw_8pysndlib_3clm_279is_wave_train(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("is_wave_train (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gen,0};
PyObject* values[1] = {0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_gen)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2943, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "is_wave_train") < 0)) __PYX_ERR(0, 2943, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 1)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
}
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)values[0]);
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("is_wave_train", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 2943, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.is_wave_train", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gen), __pyx_ptype_8pysndlib_3clm_mus_any, 1, "gen", 0))) __PYX_ERR(0, 2943, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_278is_wave_train(__pyx_self, __pyx_v_gen);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_278is_wave_train(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8pysndlib_3clm_is_wave_train(__pyx_v_gen, 0); if (unlikely(__pyx_t_1 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2943, __pyx_L1_error)
__pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2943, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("pysndlib.clm.is_wave_train", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_279is_wave_train, 0, __pyx_n_s_is_wave_train, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__388)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 2943, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_is_wave_train, __pyx_t_40) < 0) __PYX_ERR(0, 2943, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
/* … */
__pyx_codeobj__388 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__56, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_is_wave_train, 2943, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__388)) __PYX_ERR(0, 2943, __pyx_L1_error)
2944: """
2945: returns True if gen is a wave_train.
2946:
2947: :param gen: gen
2948: :rtype: bool
2949: """
+2950: return cclm.mus_is_wave_train(gen._ptr)
__pyx_r = mus_is_wave_train(__pyx_v_gen->_ptr); goto __pyx_L0;
2951:
2952:
+2953: cpdef mus_any make_wave_train_with_env(cython.double frequency, envelope, size=None):
static PyObject *__pyx_pw_8pysndlib_3clm_281make_wave_train_with_env(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_f_8pysndlib_3clm_make_wave_train_with_env(double __pyx_v_frequency, PyObject *__pyx_v_envelope, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_8pysndlib_3clm_make_wave_train_with_env *__pyx_optional_args) {
PyObject *__pyx_v_size = ((PyObject *)Py_None);
PyObject *__pyx_v_wave = NULL;
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_e = NULL;
PyObject *__pyx_v_i = NULL;
__Pyx_memviewslice __pyx_v_wave_view = { 0, 0, { 0 }, { 0 }, { 0 } };
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = NULL;
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_r = NULL;
if (__pyx_optional_args) {
if (__pyx_optional_args->__pyx_n > 0) {
__pyx_v_size = __pyx_optional_args->size;
}
}
__Pyx_INCREF(__pyx_v_size);
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_XDECREF(__pyx_t_8);
__PYX_XCLEAR_MEMVIEW(&__pyx_t_11, 1);
__Pyx_AddTraceback("pysndlib.clm.make_wave_train_with_env", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XDECREF(__pyx_v_wave);
__Pyx_XDECREF((PyObject *)__pyx_v_e);
__Pyx_XDECREF(__pyx_v_i);
__PYX_XCLEAR_MEMVIEW(&__pyx_v_wave_view, 1);
__Pyx_XDECREF((PyObject *)__pyx_v_gen);
__Pyx_XDECREF(__pyx_v_size);
__Pyx_XGIVEREF((PyObject *)__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_281make_wave_train_with_env(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_280make_wave_train_with_env, "\n return a new wave-train generator with the envelope loaded \\in with size.\n \n :param frequency: frequency of gen \\in hz\n :param env: envelope shape to load into generator\n :param size: size of wave derived from envelope\n :return: wave_train gen\n :rtype: mus_any\n \n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_281make_wave_train_with_env = {"make_wave_train_with_env", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_281make_wave_train_with_env, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_280make_wave_train_with_env};
static PyObject *__pyx_pw_8pysndlib_3clm_281make_wave_train_with_env(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
double __pyx_v_frequency;
PyObject *__pyx_v_envelope = 0;
PyObject *__pyx_v_size = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("make_wave_train_with_env (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_frequency,&__pyx_n_s_envelope,&__pyx_n_s_size,0};
PyObject* values[3] = {0,0,0};
values[2] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_frequency)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2953, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_envelope)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2953, __pyx_L3_error)
else {
__Pyx_RaiseArgtupleInvalid("make_wave_train_with_env", 0, 2, 3, 1); __PYX_ERR(0, 2953, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 2:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_size);
if (value) { values[2] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2953, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "make_wave_train_with_env") < 0)) __PYX_ERR(0, 2953, __pyx_L3_error)
}
} else {
switch (__pyx_nargs) {
case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
break;
default: goto __pyx_L5_argtuple_error;
}
}
__pyx_v_frequency = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_frequency == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2953, __pyx_L3_error)
__pyx_v_envelope = values[1];
__pyx_v_size = values[2];
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("make_wave_train_with_env", 0, 2, 3, __pyx_nargs); __PYX_ERR(0, 2953, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.make_wave_train_with_env", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_8pysndlib_3clm_280make_wave_train_with_env(__pyx_self, __pyx_v_frequency, __pyx_v_envelope, __pyx_v_size);
/* function exit code */
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_280make_wave_train_with_env(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_frequency, PyObject *__pyx_v_envelope, PyObject *__pyx_v_size) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_2.__pyx_n = 1;
__pyx_t_2.size = __pyx_v_size;
__pyx_t_1 = ((PyObject *)__pyx_f_8pysndlib_3clm_make_wave_train_with_env(__pyx_v_frequency, __pyx_v_envelope, 0, &__pyx_t_2)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2953, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("pysndlib.clm.make_wave_train_with_env", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_281make_wave_train_with_env, 0, __pyx_n_s_make_wave_train_with_env, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__389)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 2953, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
__Pyx_CyFunction_SetDefaultsTuple(__pyx_t_40, __pyx_tuple__90);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_make_wave_train_with_env, __pyx_t_40) < 0) __PYX_ERR(0, 2953, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
/* … */
__pyx_codeobj__389 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__302, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_make_wave_train_with_env, 2953, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__389)) __PYX_ERR(0, 2953, __pyx_L1_error)
/* … */
struct __pyx_opt_args_8pysndlib_3clm_make_wave_train_with_env {
int __pyx_n;
PyObject *size;
};
2954: """
2955: return a new wave-train generator with the envelope loaded \in with size.
2956:
2957: :param frequency: frequency of gen \in hz
2958: :param env: envelope shape to load into generator
2959: :param size: size of wave derived from envelope
2960: :return: wave_train gen
2961: :rtype: mus_any
2962:
2963: """
+2964: check_range('frequency', frequency, 0.0, get_srate() / 2)
__pyx_t_1 = PyFloat_FromDouble(__pyx_v_frequency); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2964, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __pyx_f_8pysndlib_3clm_get_srate(0); if (unlikely(__pyx_t_2 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2964, __pyx_L1_error) __pyx_t_3 = PyFloat_FromDouble((__pyx_t_2 / 2.0)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2964, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_5.__pyx_n = 2; __pyx_t_5.low = __pyx_float_0_0; __pyx_t_5.high = __pyx_t_3; __pyx_t_4 = __pyx_f_8pysndlib_3clm_check_range(__pyx_n_s_frequency, __pyx_t_1, 0, &__pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2964, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
2965:
+2966: size = size or CLM.table_size
__pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_size); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 2966, __pyx_L1_error) if (!__pyx_t_6) { } else { __Pyx_INCREF(__pyx_v_size); __pyx_t_4 = __pyx_v_size; goto __pyx_L3_bool_binop_done; } __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_CLM); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2966, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_table_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2966, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_INCREF(__pyx_t_1); __pyx_t_4 = __pyx_t_1; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_L3_bool_binop_done:; __Pyx_DECREF_SET(__pyx_v_size, __pyx_t_4); __pyx_t_4 = 0;
+2967: wave = np.zeros(size)
__Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2967, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2967, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = NULL; __pyx_t_7 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_3))) { __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_1)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_1); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); __pyx_t_7 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_v_size}; __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7); __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2967, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } __pyx_v_wave = __pyx_t_4; __pyx_t_4 = 0;
+2968: e = make_env(envelope, length=size)
__Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_make_env); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2968, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2968, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_v_envelope); __Pyx_GIVEREF(__pyx_v_envelope); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_envelope)) __PYX_ERR(0, 2968, __pyx_L1_error); __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2968, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_length, __pyx_v_size) < 0) __PYX_ERR(0, 2968, __pyx_L1_error) __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2968, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (!(likely(((__pyx_t_8) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_8, __pyx_ptype_8pysndlib_3clm_mus_any))))) __PYX_ERR(0, 2968, __pyx_L1_error) __pyx_v_e = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_t_8); __pyx_t_8 = 0;
+2969: for i in range(size):
__pyx_t_8 = __Pyx_PyObject_CallOneArg(__pyx_builtin_range, __pyx_v_size); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2969, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); if (likely(PyList_CheckExact(__pyx_t_8)) || PyTuple_CheckExact(__pyx_t_8)) { __pyx_t_1 = __pyx_t_8; __Pyx_INCREF(__pyx_t_1); __pyx_t_9 = 0; __pyx_t_10 = NULL; } else { __pyx_t_9 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2969, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_10 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2969, __pyx_L1_error) } __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; for (;;) { if (likely(!__pyx_t_10)) { if (likely(PyList_CheckExact(__pyx_t_1))) { { Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1); #if !CYTHON_ASSUME_SAFE_MACROS if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 2969, __pyx_L1_error) #endif if (__pyx_t_9 >= __pyx_temp) break; } #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS __pyx_t_8 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_9); __Pyx_INCREF(__pyx_t_8); __pyx_t_9++; if (unlikely((0 < 0))) __PYX_ERR(0, 2969, __pyx_L1_error) #else __pyx_t_8 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2969, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); #endif } else { { Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1); #if !CYTHON_ASSUME_SAFE_MACROS if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 2969, __pyx_L1_error) #endif if (__pyx_t_9 >= __pyx_temp) break; } #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS __pyx_t_8 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_9); __Pyx_INCREF(__pyx_t_8); __pyx_t_9++; if (unlikely((0 < 0))) __PYX_ERR(0, 2969, __pyx_L1_error) #else __pyx_t_8 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2969, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); #endif } } else { __pyx_t_8 = __pyx_t_10(__pyx_t_1); if (unlikely(!__pyx_t_8)) { PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); else __PYX_ERR(0, 2969, __pyx_L1_error) } break; } __Pyx_GOTREF(__pyx_t_8); } __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_8); __pyx_t_8 = 0; /* … */ } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+2970: wave[i] = env(e)
__pyx_t_2 = __pyx_f_8pysndlib_3clm_env(__pyx_v_e, 0); if (unlikely(__pyx_t_2 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2970, __pyx_L1_error) __pyx_t_8 = PyFloat_FromDouble(__pyx_t_2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2970, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); if (unlikely((PyObject_SetItem(__pyx_v_wave, __pyx_v_i, __pyx_t_8) < 0))) __PYX_ERR(0, 2970, __pyx_L1_error) __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+2971: cdef double [:] wave_view = wave
__pyx_t_11 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_v_wave, PyBUF_WRITABLE); if (unlikely(!__pyx_t_11.memview)) __PYX_ERR(0, 2971, __pyx_L1_error) __pyx_v_wave_view = __pyx_t_11; __pyx_t_11.memview = NULL; __pyx_t_11.data = NULL;
+2972: gen = mus_any.from_ptr(cclm.mus_make_wave_train(frequency, 0.0, &wave_view[0], size, <cclm.mus_interp_t>Interp.LINEAR))
__pyx_t_12 = 0;
__pyx_t_7 = -1;
if (__pyx_t_12 < 0) {
__pyx_t_12 += __pyx_v_wave_view.shape[0];
if (unlikely(__pyx_t_12 < 0)) __pyx_t_7 = 0;
} else if (unlikely(__pyx_t_12 >= __pyx_v_wave_view.shape[0])) __pyx_t_7 = 0;
if (unlikely(__pyx_t_7 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_7);
__PYX_ERR(0, 2972, __pyx_L1_error)
}
__pyx_t_13 = __Pyx_PyInt_As_int64_t(__pyx_v_size); if (unlikely((__pyx_t_13 == ((mus_long_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 2972, __pyx_L1_error)
__pyx_t_1 = ((PyObject *)__pyx_vtabptr_8pysndlib_3clm_mus_any->from_ptr(mus_make_wave_train(__pyx_v_frequency, 0.0, (&(*((double *) ( /* dim=0 */ (__pyx_v_wave_view.data + __pyx_t_12 * __pyx_v_wave_view.strides[0]) )))), __pyx_t_13, ((mus_interp_t)__pyx_e_8pysndlib_3clm_LINEAR)), NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2972, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_t_1);
__pyx_t_1 = 0;
+2973: gen.cache_append(wave)
__pyx_t_1 = ((struct __pyx_vtabstruct_8pysndlib_3clm_mus_any *)__pyx_v_gen->__pyx_vtab)->cache_append(__pyx_v_gen, __pyx_v_wave, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2973, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+2974: return gen
__Pyx_XDECREF((PyObject *)__pyx_r); __Pyx_INCREF((PyObject *)__pyx_v_gen); __pyx_r = __pyx_v_gen; goto __pyx_L0;
2975:
2976: # ---------------- rand, rand_interp ---------------- #
+2977: cpdef mus_any make_rand(cython.double frequency, cython.double amplitude=1.0, distribution=None):
static PyObject *__pyx_pw_8pysndlib_3clm_283make_rand(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_f_8pysndlib_3clm_make_rand(double __pyx_v_frequency, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_8pysndlib_3clm_make_rand *__pyx_optional_args) {
double __pyx_v_amplitude = ((double)1.0);
PyObject *__pyx_v_distribution = ((PyObject *)Py_None);
__Pyx_memviewslice __pyx_v_distribution_view = { 0, 0, { 0 }, { 0 }, { 0 } };
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = NULL;
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_r = NULL;
if (__pyx_optional_args) {
if (__pyx_optional_args->__pyx_n > 0) {
__pyx_v_amplitude = __pyx_optional_args->amplitude;
if (__pyx_optional_args->__pyx_n > 1) {
__pyx_v_distribution = __pyx_optional_args->distribution;
}
}
}
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__PYX_XCLEAR_MEMVIEW(&__pyx_t_6, 1);
__Pyx_AddTraceback("pysndlib.clm.make_rand", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__PYX_XCLEAR_MEMVIEW(&__pyx_v_distribution_view, 1);
__Pyx_XDECREF((PyObject *)__pyx_v_gen);
__Pyx_XGIVEREF((PyObject *)__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_283make_rand(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_282make_rand, "\n return a new rand generator, producing a sequence of random numbers (a step function). frequency\n is the rate at which new numbers are chosen.\n \n :param frequency: frequency at which new random numbers occur\n :param amplitude: numbers are between -amplitude and amplitude\n :param distribution: distribution envelope\n :return: rand gen\n :rtype: mus_any\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_283make_rand = {"make_rand", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_283make_rand, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_282make_rand};
static PyObject *__pyx_pw_8pysndlib_3clm_283make_rand(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
double __pyx_v_frequency;
double __pyx_v_amplitude;
PyObject *__pyx_v_distribution = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("make_rand (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_frequency,&__pyx_n_s_amplitude,&__pyx_n_s_distribution,0};
PyObject* values[3] = {0,0,0};
values[2] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_frequency)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2977, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_amplitude);
if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2977, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 2:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_distribution);
if (value) { values[2] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2977, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "make_rand") < 0)) __PYX_ERR(0, 2977, __pyx_L3_error)
}
} else {
switch (__pyx_nargs) {
case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
break;
default: goto __pyx_L5_argtuple_error;
}
}
__pyx_v_frequency = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_frequency == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2977, __pyx_L3_error)
if (values[1]) {
__pyx_v_amplitude = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_amplitude == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2977, __pyx_L3_error)
} else {
__pyx_v_amplitude = ((double)1.0);
}
__pyx_v_distribution = values[2];
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("make_rand", 0, 1, 3, __pyx_nargs); __PYX_ERR(0, 2977, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.make_rand", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_8pysndlib_3clm_282make_rand(__pyx_self, __pyx_v_frequency, __pyx_v_amplitude, __pyx_v_distribution);
/* function exit code */
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_282make_rand(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_frequency, double __pyx_v_amplitude, PyObject *__pyx_v_distribution) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_2.__pyx_n = 2;
__pyx_t_2.amplitude = __pyx_v_amplitude;
__pyx_t_2.distribution = __pyx_v_distribution;
__pyx_t_1 = ((PyObject *)__pyx_f_8pysndlib_3clm_make_rand(__pyx_v_frequency, 0, &__pyx_t_2)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2977, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("pysndlib.clm.make_rand", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_tuple__390 = PyTuple_Pack(3, __pyx_n_s_frequency, __pyx_n_s_amplitude, __pyx_n_s_distribution); if (unlikely(!__pyx_tuple__390)) __PYX_ERR(0, 2977, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__390);
__Pyx_GIVEREF(__pyx_tuple__390);
__pyx_codeobj__391 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__390, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_make_rand, 2977, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__391)) __PYX_ERR(0, 2977, __pyx_L1_error)
/* … */
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_283make_rand, 0, __pyx_n_s_make_rand, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__391)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 2977, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
__Pyx_CyFunction_SetDefaultsTuple(__pyx_t_40, __pyx_tuple__392);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_make_rand, __pyx_t_40) < 0) __PYX_ERR(0, 2977, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
__pyx_tuple__392 = PyTuple_Pack(2, __pyx_float_1_0, Py_None); if (unlikely(!__pyx_tuple__392)) __PYX_ERR(0, 2977, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__392);
__Pyx_GIVEREF(__pyx_tuple__392);
/* … */
struct __pyx_opt_args_8pysndlib_3clm_make_rand {
int __pyx_n;
double amplitude;
PyObject *distribution;
};
2978: """
2979: return a new rand generator, producing a sequence of random numbers (a step function). frequency
2980: is the rate at which new numbers are chosen.
2981:
2982: :param frequency: frequency at which new random numbers occur
2983: :param amplitude: numbers are between -amplitude and amplitude
2984: :param distribution: distribution envelope
2985: :return: rand gen
2986: :rtype: mus_any
2987: """
+2988: check_range('frequency', frequency, 0.0, get_srate())
__pyx_t_1 = PyFloat_FromDouble(__pyx_v_frequency); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2988, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __pyx_f_8pysndlib_3clm_get_srate(0); if (unlikely(__pyx_t_2 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2988, __pyx_L1_error) __pyx_t_3 = PyFloat_FromDouble(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2988, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_5.__pyx_n = 2; __pyx_t_5.low = __pyx_float_0_0; __pyx_t_5.high = __pyx_t_3; __pyx_t_4 = __pyx_f_8pysndlib_3clm_check_range(__pyx_n_s_frequency, __pyx_t_1, 0, &__pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2988, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+2989: cdef double [:] distribution_view = None
__pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(Py_None, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 2989, __pyx_L1_error) __pyx_v_distribution_view = __pyx_t_6; __pyx_t_6.memview = NULL; __pyx_t_6.data = NULL;
2990:
+2991: if distribution:
__pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_v_distribution); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(0, 2991, __pyx_L1_error) if (__pyx_t_7) { /* … */ }
+2992: check_ndim(distribution)
__pyx_t_4 = __pyx_f_8pysndlib_3clm_check_ndim(__pyx_v_distribution, 0, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2992, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+2993: distribution_view = distribution
__pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_v_distribution, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 2993, __pyx_L1_error) __PYX_XCLEAR_MEMVIEW(&__pyx_v_distribution_view, 1); __pyx_v_distribution_view = __pyx_t_6; __pyx_t_6.memview = NULL; __pyx_t_6.data = NULL;
+2994: gen = mus_any.from_ptr(cclm.mus_make_rand_with_distribution(frequency, amplitude, &distribution_view[0], len(distribution)))
__pyx_t_8 = 0;
__pyx_t_9 = -1;
if (__pyx_t_8 < 0) {
__pyx_t_8 += __pyx_v_distribution_view.shape[0];
if (unlikely(__pyx_t_8 < 0)) __pyx_t_9 = 0;
} else if (unlikely(__pyx_t_8 >= __pyx_v_distribution_view.shape[0])) __pyx_t_9 = 0;
if (unlikely(__pyx_t_9 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_9);
__PYX_ERR(0, 2994, __pyx_L1_error)
}
__pyx_t_10 = PyObject_Length(__pyx_v_distribution); if (unlikely(__pyx_t_10 == ((Py_ssize_t)-1))) __PYX_ERR(0, 2994, __pyx_L1_error)
__pyx_t_4 = ((PyObject *)__pyx_vtabptr_8pysndlib_3clm_mus_any->from_ptr(mus_make_rand_with_distribution(__pyx_v_frequency, __pyx_v_amplitude, (&(*((double *) ( /* dim=0 */ (__pyx_v_distribution_view.data + __pyx_t_8 * __pyx_v_distribution_view.strides[0]) )))), __pyx_t_10), NULL)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2994, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_t_4);
__pyx_t_4 = 0;
+2995: gen.cache_append(distribution)
__pyx_t_4 = ((struct __pyx_vtabstruct_8pysndlib_3clm_mus_any *)__pyx_v_gen->__pyx_vtab)->cache_append(__pyx_v_gen, __pyx_v_distribution, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2995, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+2996: return gen
__Pyx_XDECREF((PyObject *)__pyx_r); __Pyx_INCREF((PyObject *)__pyx_v_gen); __pyx_r = __pyx_v_gen; goto __pyx_L0;
2997: else:
+2998: return mus_any.from_ptr(cclm.mus_make_rand(frequency, amplitude))
/*else*/ {
__Pyx_XDECREF((PyObject *)__pyx_r);
__pyx_t_4 = ((PyObject *)__pyx_vtabptr_8pysndlib_3clm_mus_any->from_ptr(mus_make_rand(__pyx_v_frequency, __pyx_v_amplitude), NULL)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2998, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
__pyx_r = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_t_4);
__pyx_t_4 = 0;
goto __pyx_L0;
}
2999:
+3000: cpdef cython.double rand(mus_any gen, cython.double sweep=0.0):
static PyObject *__pyx_pw_8pysndlib_3clm_285rand(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static double __pyx_f_8pysndlib_3clm_rand(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_8pysndlib_3clm_rand *__pyx_optional_args) {
double __pyx_v_sweep = ((double)0.0);
double __pyx_r;
if (__pyx_optional_args) {
if (__pyx_optional_args->__pyx_n > 0) {
__pyx_v_sweep = __pyx_optional_args->sweep;
}
}
/* … */
/* function exit code */
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_285rand(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_284rand, "\n gen's current random number. sweep modulates the rate at which the current number is changed.\n \n :param gen: rand gen\n :param sweep: fm\n :rtype: float\n \n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_285rand = {"rand", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_285rand, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_284rand};
static PyObject *__pyx_pw_8pysndlib_3clm_285rand(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = 0;
double __pyx_v_sweep;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("rand (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gen,&__pyx_n_s_sweep,0};
PyObject* values[2] = {0,0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_gen)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3000, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_sweep);
if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3000, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "rand") < 0)) __PYX_ERR(0, 3000, __pyx_L3_error)
}
} else {
switch (__pyx_nargs) {
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
break;
default: goto __pyx_L5_argtuple_error;
}
}
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)values[0]);
if (values[1]) {
__pyx_v_sweep = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_sweep == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 3000, __pyx_L3_error)
} else {
__pyx_v_sweep = ((double)0.0);
}
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("rand", 0, 1, 2, __pyx_nargs); __PYX_ERR(0, 3000, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.rand", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gen), __pyx_ptype_8pysndlib_3clm_mus_any, 1, "gen", 0))) __PYX_ERR(0, 3000, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_284rand(__pyx_self, __pyx_v_gen, __pyx_v_sweep);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_284rand(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, double __pyx_v_sweep) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_2.__pyx_n = 1;
__pyx_t_2.sweep = __pyx_v_sweep;
__pyx_t_1 = __pyx_f_8pysndlib_3clm_rand(__pyx_v_gen, 0, &__pyx_t_2); if (unlikely(__pyx_t_1 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 3000, __pyx_L1_error)
__pyx_t_3 = PyFloat_FromDouble(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3000, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__pyx_r = __pyx_t_3;
__pyx_t_3 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_3);
__Pyx_AddTraceback("pysndlib.clm.rand", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_tuple__393 = PyTuple_Pack(2, __pyx_n_s_gen, __pyx_n_s_sweep); if (unlikely(!__pyx_tuple__393)) __PYX_ERR(0, 3000, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__393);
__Pyx_GIVEREF(__pyx_tuple__393);
__pyx_codeobj__394 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__393, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_rand, 3000, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__394)) __PYX_ERR(0, 3000, __pyx_L1_error)
/* … */
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_285rand, 0, __pyx_n_s_rand, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__394)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 3000, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
__Pyx_CyFunction_SetDefaultsTuple(__pyx_t_40, __pyx_tuple__395);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_rand, __pyx_t_40) < 0) __PYX_ERR(0, 3000, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
__pyx_tuple__395 = PyTuple_Pack(1, __pyx_float_0_0); if (unlikely(!__pyx_tuple__395)) __PYX_ERR(0, 3000, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__395);
__Pyx_GIVEREF(__pyx_tuple__395);
3001: """
3002: gen's current random number. sweep modulates the rate at which the current number is changed.
3003:
3004: :param gen: rand gen
3005: :param sweep: fm
3006: :rtype: float
3007:
3008: """
+3009: return cclm.mus_rand(gen._ptr, sweep)
__pyx_r = mus_rand(__pyx_v_gen->_ptr, __pyx_v_sweep); goto __pyx_L0;
3010:
+3011: cpdef cython.double rand_unmodulated(mus_any gen):
static PyObject *__pyx_pw_8pysndlib_3clm_287rand_unmodulated(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static double __pyx_f_8pysndlib_3clm_rand_unmodulated(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, CYTHON_UNUSED int __pyx_skip_dispatch) {
double __pyx_r;
/* … */
/* function exit code */
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_287rand_unmodulated(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_286rand_unmodulated, "\n gen's current random number. sweep modulates the rate at which the current number is changed. unmodulated\n \n :param gen: rand gen\n :rtype: float\n \n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_287rand_unmodulated = {"rand_unmodulated", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_287rand_unmodulated, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_286rand_unmodulated};
static PyObject *__pyx_pw_8pysndlib_3clm_287rand_unmodulated(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("rand_unmodulated (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gen,0};
PyObject* values[1] = {0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_gen)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3011, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "rand_unmodulated") < 0)) __PYX_ERR(0, 3011, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 1)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
}
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)values[0]);
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("rand_unmodulated", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 3011, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.rand_unmodulated", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gen), __pyx_ptype_8pysndlib_3clm_mus_any, 1, "gen", 0))) __PYX_ERR(0, 3011, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_286rand_unmodulated(__pyx_self, __pyx_v_gen);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_286rand_unmodulated(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8pysndlib_3clm_rand_unmodulated(__pyx_v_gen, 0); if (unlikely(__pyx_t_1 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 3011, __pyx_L1_error)
__pyx_t_2 = PyFloat_FromDouble(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3011, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("pysndlib.clm.rand_unmodulated", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_287rand_unmodulated, 0, __pyx_n_s_rand_unmodulated, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__396)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 3011, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_rand_unmodulated, __pyx_t_40) < 0) __PYX_ERR(0, 3011, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
/* … */
__pyx_codeobj__396 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__56, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_rand_unmodulated, 3011, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__396)) __PYX_ERR(0, 3011, __pyx_L1_error)
3012: """
3013: gen's current random number. sweep modulates the rate at which the current number is changed. unmodulated
3014:
3015: :param gen: rand gen
3016: :rtype: float
3017:
3018: """
+3019: return cclm.mus_rand_unmodulated(gen._ptr)
__pyx_r = mus_rand_unmodulated(__pyx_v_gen->_ptr); goto __pyx_L0;
3020:
+3021: cpdef bint is_rand(mus_any gen):
static PyObject *__pyx_pw_8pysndlib_3clm_289is_rand(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static int __pyx_f_8pysndlib_3clm_is_rand(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, CYTHON_UNUSED int __pyx_skip_dispatch) {
int __pyx_r;
/* … */
/* function exit code */
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_289is_rand(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_288is_rand, "\n returns True if gen is a rand.\n \n :param gen: gen\n :rtype: bool\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_289is_rand = {"is_rand", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_289is_rand, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_288is_rand};
static PyObject *__pyx_pw_8pysndlib_3clm_289is_rand(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("is_rand (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gen,0};
PyObject* values[1] = {0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_gen)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3021, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "is_rand") < 0)) __PYX_ERR(0, 3021, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 1)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
}
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)values[0]);
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("is_rand", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 3021, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.is_rand", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gen), __pyx_ptype_8pysndlib_3clm_mus_any, 1, "gen", 0))) __PYX_ERR(0, 3021, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_288is_rand(__pyx_self, __pyx_v_gen);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_288is_rand(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8pysndlib_3clm_is_rand(__pyx_v_gen, 0); if (unlikely(__pyx_t_1 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3021, __pyx_L1_error)
__pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3021, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("pysndlib.clm.is_rand", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_289is_rand, 0, __pyx_n_s_is_rand, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__397)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 3021, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_is_rand, __pyx_t_40) < 0) __PYX_ERR(0, 3021, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
/* … */
__pyx_codeobj__397 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__56, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_is_rand, 3021, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__397)) __PYX_ERR(0, 3021, __pyx_L1_error)
3022: """
3023: returns True if gen is a rand.
3024:
3025: :param gen: gen
3026: :rtype: bool
3027: """
+3028: return cclm.mus_is_rand(gen._ptr)
__pyx_r = mus_is_rand(__pyx_v_gen->_ptr); goto __pyx_L0;
3029:
+3030: cpdef mus_any make_rand_interp(cython.double frequency, cython.double amplitude=1.0, distribution=None):
static PyObject *__pyx_pw_8pysndlib_3clm_291make_rand_interp(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_f_8pysndlib_3clm_make_rand_interp(double __pyx_v_frequency, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_8pysndlib_3clm_make_rand_interp *__pyx_optional_args) {
double __pyx_v_amplitude = ((double)1.0);
PyObject *__pyx_v_distribution = ((PyObject *)Py_None);
__Pyx_memviewslice __pyx_v_distribution_view = { 0, 0, { 0 }, { 0 }, { 0 } };
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = NULL;
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_r = NULL;
if (__pyx_optional_args) {
if (__pyx_optional_args->__pyx_n > 0) {
__pyx_v_amplitude = __pyx_optional_args->amplitude;
if (__pyx_optional_args->__pyx_n > 1) {
__pyx_v_distribution = __pyx_optional_args->distribution;
}
}
}
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__PYX_XCLEAR_MEMVIEW(&__pyx_t_6, 1);
__Pyx_AddTraceback("pysndlib.clm.make_rand_interp", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__PYX_XCLEAR_MEMVIEW(&__pyx_v_distribution_view, 1);
__Pyx_XDECREF((PyObject *)__pyx_v_gen);
__Pyx_XGIVEREF((PyObject *)__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_291make_rand_interp(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_290make_rand_interp, "\n return a new rand_interp generator, producing linearly interpolated random numbers. frequency is\n the rate at which new end-points are chosen.\n \n :param frequency: frequency at which new random numbers occur\n :param amplitude: numbers are between -amplitude and amplitude\n :param distribution: distribution envelope\n :return: rand_interp gen\n :rtype: mus_any\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_291make_rand_interp = {"make_rand_interp", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_291make_rand_interp, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_290make_rand_interp};
static PyObject *__pyx_pw_8pysndlib_3clm_291make_rand_interp(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
double __pyx_v_frequency;
double __pyx_v_amplitude;
PyObject *__pyx_v_distribution = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("make_rand_interp (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_frequency,&__pyx_n_s_amplitude,&__pyx_n_s_distribution,0};
PyObject* values[3] = {0,0,0};
values[2] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_frequency)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3030, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_amplitude);
if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3030, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 2:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_distribution);
if (value) { values[2] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3030, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "make_rand_interp") < 0)) __PYX_ERR(0, 3030, __pyx_L3_error)
}
} else {
switch (__pyx_nargs) {
case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
break;
default: goto __pyx_L5_argtuple_error;
}
}
__pyx_v_frequency = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_frequency == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 3030, __pyx_L3_error)
if (values[1]) {
__pyx_v_amplitude = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_amplitude == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 3030, __pyx_L3_error)
} else {
__pyx_v_amplitude = ((double)1.0);
}
__pyx_v_distribution = values[2];
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("make_rand_interp", 0, 1, 3, __pyx_nargs); __PYX_ERR(0, 3030, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.make_rand_interp", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_8pysndlib_3clm_290make_rand_interp(__pyx_self, __pyx_v_frequency, __pyx_v_amplitude, __pyx_v_distribution);
/* function exit code */
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_290make_rand_interp(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_frequency, double __pyx_v_amplitude, PyObject *__pyx_v_distribution) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_2.__pyx_n = 2;
__pyx_t_2.amplitude = __pyx_v_amplitude;
__pyx_t_2.distribution = __pyx_v_distribution;
__pyx_t_1 = ((PyObject *)__pyx_f_8pysndlib_3clm_make_rand_interp(__pyx_v_frequency, 0, &__pyx_t_2)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3030, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("pysndlib.clm.make_rand_interp", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_codeobj__398 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__390, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_make_rand_interp, 3030, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__398)) __PYX_ERR(0, 3030, __pyx_L1_error)
/* … */
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_291make_rand_interp, 0, __pyx_n_s_make_rand_interp, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__398)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 3030, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
__Pyx_CyFunction_SetDefaultsTuple(__pyx_t_40, __pyx_tuple__399);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_make_rand_interp, __pyx_t_40) < 0) __PYX_ERR(0, 3030, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
__pyx_tuple__399 = PyTuple_Pack(2, __pyx_float_1_0, Py_None); if (unlikely(!__pyx_tuple__399)) __PYX_ERR(0, 3030, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__399);
__Pyx_GIVEREF(__pyx_tuple__399);
/* … */
struct __pyx_opt_args_8pysndlib_3clm_make_rand_interp {
int __pyx_n;
double amplitude;
PyObject *distribution;
};
3031: """
3032: return a new rand_interp generator, producing linearly interpolated random numbers. frequency is
3033: the rate at which new end-points are chosen.
3034:
3035: :param frequency: frequency at which new random numbers occur
3036: :param amplitude: numbers are between -amplitude and amplitude
3037: :param distribution: distribution envelope
3038: :return: rand_interp gen
3039: :rtype: mus_any
3040: """
+3041: check_range('frequency', frequency, 0.0, get_srate())
__pyx_t_1 = PyFloat_FromDouble(__pyx_v_frequency); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3041, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __pyx_f_8pysndlib_3clm_get_srate(0); if (unlikely(__pyx_t_2 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 3041, __pyx_L1_error) __pyx_t_3 = PyFloat_FromDouble(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3041, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_5.__pyx_n = 2; __pyx_t_5.low = __pyx_float_0_0; __pyx_t_5.high = __pyx_t_3; __pyx_t_4 = __pyx_f_8pysndlib_3clm_check_range(__pyx_n_s_frequency, __pyx_t_1, 0, &__pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3041, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+3042: cdef double [:] distribution_view = None
__pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(Py_None, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 3042, __pyx_L1_error) __pyx_v_distribution_view = __pyx_t_6; __pyx_t_6.memview = NULL; __pyx_t_6.data = NULL;
3043:
+3044: if distribution:
__pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_v_distribution); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(0, 3044, __pyx_L1_error) if (__pyx_t_7) { /* … */ }
+3045: check_ndim(distribution)
__pyx_t_4 = __pyx_f_8pysndlib_3clm_check_ndim(__pyx_v_distribution, 0, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3045, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+3046: distribution_view = distribution
__pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_v_distribution, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 3046, __pyx_L1_error) __PYX_XCLEAR_MEMVIEW(&__pyx_v_distribution_view, 1); __pyx_v_distribution_view = __pyx_t_6; __pyx_t_6.memview = NULL; __pyx_t_6.data = NULL;
+3047: gen = mus_any.from_ptr(cclm.mus_make_rand_interp_with_distribution(frequency, amplitude, &distribution_view[0], len(distribution)))
__pyx_t_8 = 0;
__pyx_t_9 = -1;
if (__pyx_t_8 < 0) {
__pyx_t_8 += __pyx_v_distribution_view.shape[0];
if (unlikely(__pyx_t_8 < 0)) __pyx_t_9 = 0;
} else if (unlikely(__pyx_t_8 >= __pyx_v_distribution_view.shape[0])) __pyx_t_9 = 0;
if (unlikely(__pyx_t_9 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_9);
__PYX_ERR(0, 3047, __pyx_L1_error)
}
__pyx_t_10 = PyObject_Length(__pyx_v_distribution); if (unlikely(__pyx_t_10 == ((Py_ssize_t)-1))) __PYX_ERR(0, 3047, __pyx_L1_error)
__pyx_t_4 = ((PyObject *)__pyx_vtabptr_8pysndlib_3clm_mus_any->from_ptr(mus_make_rand_interp_with_distribution(__pyx_v_frequency, __pyx_v_amplitude, (&(*((double *) ( /* dim=0 */ (__pyx_v_distribution_view.data + __pyx_t_8 * __pyx_v_distribution_view.strides[0]) )))), __pyx_t_10), NULL)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3047, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_t_4);
__pyx_t_4 = 0;
+3048: gen.cache_append(distribution)
__pyx_t_4 = ((struct __pyx_vtabstruct_8pysndlib_3clm_mus_any *)__pyx_v_gen->__pyx_vtab)->cache_append(__pyx_v_gen, __pyx_v_distribution, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3048, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+3049: return gen
__Pyx_XDECREF((PyObject *)__pyx_r); __Pyx_INCREF((PyObject *)__pyx_v_gen); __pyx_r = __pyx_v_gen; goto __pyx_L0;
3050: else:
+3051: return mus_any.from_ptr(cclm.mus_make_rand_interp(frequency, amplitude))
/*else*/ {
__Pyx_XDECREF((PyObject *)__pyx_r);
__pyx_t_4 = ((PyObject *)__pyx_vtabptr_8pysndlib_3clm_mus_any->from_ptr(mus_make_rand_interp(__pyx_v_frequency, __pyx_v_amplitude), NULL)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3051, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
__pyx_r = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_t_4);
__pyx_t_4 = 0;
goto __pyx_L0;
}
3052:
+3053: cpdef rand_interp(mus_any gen, cython.double sweep=0.):
static PyObject *__pyx_pw_8pysndlib_3clm_293rand_interp(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyObject *__pyx_f_8pysndlib_3clm_rand_interp(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_8pysndlib_3clm_rand_interp *__pyx_optional_args) {
double __pyx_v_sweep = ((double)0.);
PyObject *__pyx_r = NULL;
if (__pyx_optional_args) {
if (__pyx_optional_args->__pyx_n > 0) {
__pyx_v_sweep = __pyx_optional_args->sweep;
}
}
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("pysndlib.clm.rand_interp", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_293rand_interp(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_292rand_interp, "\n gen's current (interpolating) random number. fm modulates the rate at which new segment end-points\n are chosen.\n \n :param gen: rand_interp gen\n :param sweep: fm \n :rtype: float\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_293rand_interp = {"rand_interp", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_293rand_interp, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_292rand_interp};
static PyObject *__pyx_pw_8pysndlib_3clm_293rand_interp(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = 0;
double __pyx_v_sweep;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("rand_interp (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gen,&__pyx_n_s_sweep,0};
PyObject* values[2] = {0,0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_gen)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3053, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_sweep);
if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3053, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "rand_interp") < 0)) __PYX_ERR(0, 3053, __pyx_L3_error)
}
} else {
switch (__pyx_nargs) {
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
break;
default: goto __pyx_L5_argtuple_error;
}
}
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)values[0]);
if (values[1]) {
__pyx_v_sweep = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_sweep == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 3053, __pyx_L3_error)
} else {
__pyx_v_sweep = ((double)0.);
}
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("rand_interp", 0, 1, 2, __pyx_nargs); __PYX_ERR(0, 3053, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.rand_interp", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gen), __pyx_ptype_8pysndlib_3clm_mus_any, 1, "gen", 0))) __PYX_ERR(0, 3053, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_292rand_interp(__pyx_self, __pyx_v_gen, __pyx_v_sweep);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_292rand_interp(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, double __pyx_v_sweep) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_2.__pyx_n = 1;
__pyx_t_2.sweep = __pyx_v_sweep;
__pyx_t_1 = __pyx_f_8pysndlib_3clm_rand_interp(__pyx_v_gen, 0, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3053, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("pysndlib.clm.rand_interp", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_codeobj__400 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__393, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_rand_interp, 3053, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__400)) __PYX_ERR(0, 3053, __pyx_L1_error)
/* … */
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_293rand_interp, 0, __pyx_n_s_rand_interp, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__400)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 3053, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
__Pyx_CyFunction_SetDefaultsTuple(__pyx_t_40, __pyx_tuple__401);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_rand_interp, __pyx_t_40) < 0) __PYX_ERR(0, 3053, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
__pyx_tuple__401 = PyTuple_Pack(1, __pyx_float_0_); if (unlikely(!__pyx_tuple__401)) __PYX_ERR(0, 3053, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__401);
__Pyx_GIVEREF(__pyx_tuple__401);
3054: """
3055: gen's current (interpolating) random number. fm modulates the rate at which new segment end-points
3056: are chosen.
3057:
3058: :param gen: rand_interp gen
3059: :param sweep: fm
3060: :rtype: float
3061: """
+3062: return cclm.mus_rand_interp(gen._ptr, sweep)
__Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyFloat_FromDouble(mus_rand_interp(__pyx_v_gen->_ptr, __pyx_v_sweep)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3062, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
3063:
+3064: cpdef rand_interp_unmodulated(mus_any gen):
static PyObject *__pyx_pw_8pysndlib_3clm_295rand_interp_unmodulated(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyObject *__pyx_f_8pysndlib_3clm_rand_interp_unmodulated(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, CYTHON_UNUSED int __pyx_skip_dispatch) {
PyObject *__pyx_r = NULL;
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("pysndlib.clm.rand_interp_unmodulated", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_295rand_interp_unmodulated(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_294rand_interp_unmodulated, "\n gen's current (interpolating) random number. fm modulates the rate at which new segment end-points\n are chosen. unmodulated\n \n :param gen: rand_interp gen\n :rtype: float\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_295rand_interp_unmodulated = {"rand_interp_unmodulated", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_295rand_interp_unmodulated, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_294rand_interp_unmodulated};
static PyObject *__pyx_pw_8pysndlib_3clm_295rand_interp_unmodulated(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("rand_interp_unmodulated (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gen,0};
PyObject* values[1] = {0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_gen)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3064, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "rand_interp_unmodulated") < 0)) __PYX_ERR(0, 3064, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 1)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
}
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)values[0]);
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("rand_interp_unmodulated", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 3064, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.rand_interp_unmodulated", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gen), __pyx_ptype_8pysndlib_3clm_mus_any, 1, "gen", 0))) __PYX_ERR(0, 3064, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_294rand_interp_unmodulated(__pyx_self, __pyx_v_gen);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_294rand_interp_unmodulated(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8pysndlib_3clm_rand_interp_unmodulated(__pyx_v_gen, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3064, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("pysndlib.clm.rand_interp_unmodulated", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_295rand_interp_unmodulated, 0, __pyx_n_s_rand_interp_unmodulated, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__402)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 3064, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_rand_interp_unmodulated, __pyx_t_40) < 0) __PYX_ERR(0, 3064, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
/* … */
__pyx_codeobj__402 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__56, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_rand_interp_unmodulated, 3064, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__402)) __PYX_ERR(0, 3064, __pyx_L1_error)
3065: """
3066: gen's current (interpolating) random number. fm modulates the rate at which new segment end-points
3067: are chosen. unmodulated
3068:
3069: :param gen: rand_interp gen
3070: :rtype: float
3071: """
+3072: return cclm.mus_rand_interp_unmodulated(gen._ptr)
__Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyFloat_FromDouble(mus_rand_interp_unmodulated(__pyx_v_gen->_ptr)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3072, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
3073:
3074:
+3075: cpdef bint is_rand_interp(mus_any gen):
static PyObject *__pyx_pw_8pysndlib_3clm_297is_rand_interp(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static int __pyx_f_8pysndlib_3clm_is_rand_interp(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, CYTHON_UNUSED int __pyx_skip_dispatch) {
int __pyx_r;
/* … */
/* function exit code */
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_297is_rand_interp(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_296is_rand_interp, "\n returns True if gen is a rand_interp.\n :param gen: gen\n :rtype: bool\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_297is_rand_interp = {"is_rand_interp", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_297is_rand_interp, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_296is_rand_interp};
static PyObject *__pyx_pw_8pysndlib_3clm_297is_rand_interp(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("is_rand_interp (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gen,0};
PyObject* values[1] = {0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_gen)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3075, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "is_rand_interp") < 0)) __PYX_ERR(0, 3075, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 1)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
}
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)values[0]);
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("is_rand_interp", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 3075, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.is_rand_interp", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gen), __pyx_ptype_8pysndlib_3clm_mus_any, 1, "gen", 0))) __PYX_ERR(0, 3075, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_296is_rand_interp(__pyx_self, __pyx_v_gen);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_296is_rand_interp(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8pysndlib_3clm_is_rand_interp(__pyx_v_gen, 0); if (unlikely(__pyx_t_1 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3075, __pyx_L1_error)
__pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3075, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("pysndlib.clm.is_rand_interp", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_297is_rand_interp, 0, __pyx_n_s_is_rand_interp, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__403)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 3075, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_is_rand_interp, __pyx_t_40) < 0) __PYX_ERR(0, 3075, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
/* … */
__pyx_codeobj__403 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__56, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_is_rand_interp, 3075, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__403)) __PYX_ERR(0, 3075, __pyx_L1_error)
3076: """
3077: returns True if gen is a rand_interp.
3078: :param gen: gen
3079: :rtype: bool
3080: """
+3081: return cclm.mus_is_rand_interp(gen._ptr)
__pyx_r = mus_is_rand_interp(__pyx_v_gen->_ptr); goto __pyx_L0;
3082:
3083:
3084: # ---------------- simple filters ---------------- #
+3085: cpdef mus_any make_one_pole(cython.double a0, cython.double b1):
static PyObject *__pyx_pw_8pysndlib_3clm_299make_one_pole(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_f_8pysndlib_3clm_make_one_pole(double __pyx_v_a0, double __pyx_v_b1, CYTHON_UNUSED int __pyx_skip_dispatch) {
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_r = NULL;
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("pysndlib.clm.make_one_pole", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XGIVEREF((PyObject *)__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_299make_one_pole(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_298make_one_pole, "\n return a new one_pole filter: y(n) = a0 x(n) - b1 y(n-1)\n b1 < 0.0 gives lowpass, b1 > 0.0 gives highpass.\n \n :param a0: coefficient\n :param b1: coefficient\n :return: one_pole gen\n :rtype: mus_any\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_299make_one_pole = {"make_one_pole", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_299make_one_pole, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_298make_one_pole};
static PyObject *__pyx_pw_8pysndlib_3clm_299make_one_pole(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
double __pyx_v_a0;
double __pyx_v_b1;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("make_one_pole (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_a0,&__pyx_n_s_b1,0};
PyObject* values[2] = {0,0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_a0)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3085, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_b1)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3085, __pyx_L3_error)
else {
__Pyx_RaiseArgtupleInvalid("make_one_pole", 1, 2, 2, 1); __PYX_ERR(0, 3085, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "make_one_pole") < 0)) __PYX_ERR(0, 3085, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 2)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
}
__pyx_v_a0 = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_a0 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 3085, __pyx_L3_error)
__pyx_v_b1 = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_b1 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 3085, __pyx_L3_error)
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("make_one_pole", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 3085, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.make_one_pole", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_8pysndlib_3clm_298make_one_pole(__pyx_self, __pyx_v_a0, __pyx_v_b1);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_298make_one_pole(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_a0, double __pyx_v_b1) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = ((PyObject *)__pyx_f_8pysndlib_3clm_make_one_pole(__pyx_v_a0, __pyx_v_b1, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3085, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("pysndlib.clm.make_one_pole", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_tuple__404 = PyTuple_Pack(2, __pyx_n_s_a0, __pyx_n_s_b1); if (unlikely(!__pyx_tuple__404)) __PYX_ERR(0, 3085, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__404);
__Pyx_GIVEREF(__pyx_tuple__404);
/* … */
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_299make_one_pole, 0, __pyx_n_s_make_one_pole, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__405)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 3085, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_make_one_pole, __pyx_t_40) < 0) __PYX_ERR(0, 3085, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
__pyx_codeobj__405 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__404, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_make_one_pole, 3085, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__405)) __PYX_ERR(0, 3085, __pyx_L1_error)
3086: """
3087: return a new one_pole filter: y(n) = a0 x(n) - b1 y(n-1)
3088: b1 < 0.0 gives lowpass, b1 > 0.0 gives highpass.
3089:
3090: :param a0: coefficient
3091: :param b1: coefficient
3092: :return: one_pole gen
3093: :rtype: mus_any
3094: """
3095:
+3096: return mus_any.from_ptr(cclm.mus_make_one_pole(a0, b1))
__Pyx_XDECREF((PyObject *)__pyx_r); __pyx_t_1 = ((PyObject *)__pyx_vtabptr_8pysndlib_3clm_mus_any->from_ptr(mus_make_one_pole(__pyx_v_a0, __pyx_v_b1), NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3096, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0;
3097:
3098:
3099:
+3100: cpdef cython.double one_pole(mus_any gen, cython.double insig):
static PyObject *__pyx_pw_8pysndlib_3clm_301one_pole(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static double __pyx_f_8pysndlib_3clm_one_pole(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, double __pyx_v_insig, CYTHON_UNUSED int __pyx_skip_dispatch) {
double __pyx_r;
/* … */
/* function exit code */
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_301one_pole(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_300one_pole, "\n one pole filter of input.\n \n :param gen: one_pole gen\n :param insig: input \n :rtype: float\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_301one_pole = {"one_pole", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_301one_pole, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_300one_pole};
static PyObject *__pyx_pw_8pysndlib_3clm_301one_pole(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = 0;
double __pyx_v_insig;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("one_pole (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gen,&__pyx_n_s_insig,0};
PyObject* values[2] = {0,0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_gen)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3100, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_insig)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3100, __pyx_L3_error)
else {
__Pyx_RaiseArgtupleInvalid("one_pole", 1, 2, 2, 1); __PYX_ERR(0, 3100, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "one_pole") < 0)) __PYX_ERR(0, 3100, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 2)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
}
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)values[0]);
__pyx_v_insig = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_insig == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 3100, __pyx_L3_error)
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("one_pole", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 3100, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.one_pole", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gen), __pyx_ptype_8pysndlib_3clm_mus_any, 1, "gen", 0))) __PYX_ERR(0, 3100, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_300one_pole(__pyx_self, __pyx_v_gen, __pyx_v_insig);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_300one_pole(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, double __pyx_v_insig) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8pysndlib_3clm_one_pole(__pyx_v_gen, __pyx_v_insig, 0); if (unlikely(__pyx_t_1 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 3100, __pyx_L1_error)
__pyx_t_2 = PyFloat_FromDouble(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3100, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("pysndlib.clm.one_pole", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_301one_pole, 0, __pyx_n_s_one_pole, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__406)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 3100, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_one_pole, __pyx_t_40) < 0) __PYX_ERR(0, 3100, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
/* … */
__pyx_codeobj__406 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__380, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_one_pole, 3100, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__406)) __PYX_ERR(0, 3100, __pyx_L1_error)
3101: """
3102: one pole filter of input.
3103:
3104: :param gen: one_pole gen
3105: :param insig: input
3106: :rtype: float
3107: """
3108:
+3109: return cclm.mus_one_pole(gen._ptr, insig)
__pyx_r = mus_one_pole(__pyx_v_gen->_ptr, __pyx_v_insig); goto __pyx_L0;
3110:
+3111: cpdef bint is_one_pole(mus_any gen):
static PyObject *__pyx_pw_8pysndlib_3clm_303is_one_pole(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static int __pyx_f_8pysndlib_3clm_is_one_pole(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, CYTHON_UNUSED int __pyx_skip_dispatch) {
int __pyx_r;
/* … */
/* function exit code */
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_303is_one_pole(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_302is_one_pole, "\n returns True if gen is a one_pole.\n \n :param gen: gen\n :rtype: bool\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_303is_one_pole = {"is_one_pole", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_303is_one_pole, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_302is_one_pole};
static PyObject *__pyx_pw_8pysndlib_3clm_303is_one_pole(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("is_one_pole (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gen,0};
PyObject* values[1] = {0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_gen)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3111, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "is_one_pole") < 0)) __PYX_ERR(0, 3111, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 1)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
}
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)values[0]);
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("is_one_pole", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 3111, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.is_one_pole", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gen), __pyx_ptype_8pysndlib_3clm_mus_any, 1, "gen", 0))) __PYX_ERR(0, 3111, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_302is_one_pole(__pyx_self, __pyx_v_gen);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_302is_one_pole(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8pysndlib_3clm_is_one_pole(__pyx_v_gen, 0); if (unlikely(__pyx_t_1 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3111, __pyx_L1_error)
__pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3111, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("pysndlib.clm.is_one_pole", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_303is_one_pole, 0, __pyx_n_s_is_one_pole, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__407)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 3111, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_is_one_pole, __pyx_t_40) < 0) __PYX_ERR(0, 3111, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
/* … */
__pyx_codeobj__407 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__56, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_is_one_pole, 3111, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__407)) __PYX_ERR(0, 3111, __pyx_L1_error)
3112: """
3113: returns True if gen is a one_pole.
3114:
3115: :param gen: gen
3116: :rtype: bool
3117: """
+3118: return cclm.mus_is_one_pole(gen._ptr)
__pyx_r = mus_is_one_pole(__pyx_v_gen->_ptr); goto __pyx_L0;
3119:
3120:
+3121: cpdef mus_any make_one_zero(cython.double a0 , cython.double a1):
static PyObject *__pyx_pw_8pysndlib_3clm_305make_one_zero(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_f_8pysndlib_3clm_make_one_zero(double __pyx_v_a0, double __pyx_v_a1, CYTHON_UNUSED int __pyx_skip_dispatch) {
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_r = NULL;
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("pysndlib.clm.make_one_zero", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XGIVEREF((PyObject *)__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_305make_one_zero(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_304make_one_zero, "\n return a new one_zero filter: y(n) = a0 x(n) + a1 x(n-1)\n a1 > 0.0 gives weak lowpass, a1 < 0.0 highpass.\n \n :param a0: coefficient\n :param a1: coefficient\n :return: one_pole gen\n :rtype: mus_any\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_305make_one_zero = {"make_one_zero", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_305make_one_zero, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_304make_one_zero};
static PyObject *__pyx_pw_8pysndlib_3clm_305make_one_zero(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
double __pyx_v_a0;
double __pyx_v_a1;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("make_one_zero (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_a0,&__pyx_n_s_a1,0};
PyObject* values[2] = {0,0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_a0)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3121, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_a1)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3121, __pyx_L3_error)
else {
__Pyx_RaiseArgtupleInvalid("make_one_zero", 1, 2, 2, 1); __PYX_ERR(0, 3121, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "make_one_zero") < 0)) __PYX_ERR(0, 3121, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 2)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
}
__pyx_v_a0 = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_a0 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 3121, __pyx_L3_error)
__pyx_v_a1 = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_a1 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 3121, __pyx_L3_error)
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("make_one_zero", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 3121, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.make_one_zero", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_8pysndlib_3clm_304make_one_zero(__pyx_self, __pyx_v_a0, __pyx_v_a1);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_304make_one_zero(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_a0, double __pyx_v_a1) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = ((PyObject *)__pyx_f_8pysndlib_3clm_make_one_zero(__pyx_v_a0, __pyx_v_a1, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3121, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("pysndlib.clm.make_one_zero", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_tuple__408 = PyTuple_Pack(2, __pyx_n_s_a0, __pyx_n_s_a1); if (unlikely(!__pyx_tuple__408)) __PYX_ERR(0, 3121, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__408);
__Pyx_GIVEREF(__pyx_tuple__408);
/* … */
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_305make_one_zero, 0, __pyx_n_s_make_one_zero, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__409)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 3121, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_make_one_zero, __pyx_t_40) < 0) __PYX_ERR(0, 3121, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
__pyx_codeobj__409 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__408, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_make_one_zero, 3121, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__409)) __PYX_ERR(0, 3121, __pyx_L1_error)
3122: """
3123: return a new one_zero filter: y(n) = a0 x(n) + a1 x(n-1)
3124: a1 > 0.0 gives weak lowpass, a1 < 0.0 highpass.
3125:
3126: :param a0: coefficient
3127: :param a1: coefficient
3128: :return: one_pole gen
3129: :rtype: mus_any
3130: """
+3131: return mus_any.from_ptr(cclm.mus_make_one_zero(a0, a1))
__Pyx_XDECREF((PyObject *)__pyx_r); __pyx_t_1 = ((PyObject *)__pyx_vtabptr_8pysndlib_3clm_mus_any->from_ptr(mus_make_one_zero(__pyx_v_a0, __pyx_v_a1), NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3131, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0;
3132:
+3133: cpdef cython.double one_zero(mus_any gen, cython.double insig):
static PyObject *__pyx_pw_8pysndlib_3clm_307one_zero(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static double __pyx_f_8pysndlib_3clm_one_zero(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, double __pyx_v_insig, CYTHON_UNUSED int __pyx_skip_dispatch) {
double __pyx_r;
/* … */
/* function exit code */
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_307one_zero(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_306one_zero, "\n one zero filter of input.\n \n :param gen: one_zero gen\n :param insig: input \n :rtype: float\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_307one_zero = {"one_zero", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_307one_zero, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_306one_zero};
static PyObject *__pyx_pw_8pysndlib_3clm_307one_zero(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = 0;
double __pyx_v_insig;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("one_zero (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gen,&__pyx_n_s_insig,0};
PyObject* values[2] = {0,0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_gen)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3133, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_insig)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3133, __pyx_L3_error)
else {
__Pyx_RaiseArgtupleInvalid("one_zero", 1, 2, 2, 1); __PYX_ERR(0, 3133, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "one_zero") < 0)) __PYX_ERR(0, 3133, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 2)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
}
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)values[0]);
__pyx_v_insig = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_insig == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 3133, __pyx_L3_error)
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("one_zero", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 3133, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.one_zero", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gen), __pyx_ptype_8pysndlib_3clm_mus_any, 1, "gen", 0))) __PYX_ERR(0, 3133, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_306one_zero(__pyx_self, __pyx_v_gen, __pyx_v_insig);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_306one_zero(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, double __pyx_v_insig) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8pysndlib_3clm_one_zero(__pyx_v_gen, __pyx_v_insig, 0); if (unlikely(__pyx_t_1 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 3133, __pyx_L1_error)
__pyx_t_2 = PyFloat_FromDouble(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3133, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("pysndlib.clm.one_zero", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_307one_zero, 0, __pyx_n_s_one_zero, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__410)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 3133, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_one_zero, __pyx_t_40) < 0) __PYX_ERR(0, 3133, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
/* … */
__pyx_codeobj__410 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__380, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_one_zero, 3133, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__410)) __PYX_ERR(0, 3133, __pyx_L1_error)
3134: """
3135: one zero filter of input.
3136:
3137: :param gen: one_zero gen
3138: :param insig: input
3139: :rtype: float
3140: """
+3141: return cclm.mus_one_zero(gen._ptr, insig)
__pyx_r = mus_one_zero(__pyx_v_gen->_ptr, __pyx_v_insig); goto __pyx_L0;
3142:
+3143: cpdef bint is_one_zero(mus_any gen):
static PyObject *__pyx_pw_8pysndlib_3clm_309is_one_zero(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static int __pyx_f_8pysndlib_3clm_is_one_zero(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, CYTHON_UNUSED int __pyx_skip_dispatch) {
int __pyx_r;
/* … */
/* function exit code */
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_309is_one_zero(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_308is_one_zero, "\n returns True if gen is a one_zero.\n \n :param gen: gen\n :rtype: bool\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_309is_one_zero = {"is_one_zero", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_309is_one_zero, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_308is_one_zero};
static PyObject *__pyx_pw_8pysndlib_3clm_309is_one_zero(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("is_one_zero (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gen,0};
PyObject* values[1] = {0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_gen)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3143, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "is_one_zero") < 0)) __PYX_ERR(0, 3143, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 1)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
}
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)values[0]);
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("is_one_zero", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 3143, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.is_one_zero", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gen), __pyx_ptype_8pysndlib_3clm_mus_any, 1, "gen", 0))) __PYX_ERR(0, 3143, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_308is_one_zero(__pyx_self, __pyx_v_gen);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_308is_one_zero(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8pysndlib_3clm_is_one_zero(__pyx_v_gen, 0); if (unlikely(__pyx_t_1 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3143, __pyx_L1_error)
__pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3143, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("pysndlib.clm.is_one_zero", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_309is_one_zero, 0, __pyx_n_s_is_one_zero, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__411)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 3143, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_is_one_zero, __pyx_t_40) < 0) __PYX_ERR(0, 3143, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
/* … */
__pyx_codeobj__411 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__56, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_is_one_zero, 3143, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__411)) __PYX_ERR(0, 3143, __pyx_L1_error)
3144: """
3145: returns True if gen is a one_zero.
3146:
3147: :param gen: gen
3148: :rtype: bool
3149: """
+3150: return cclm.mus_is_one_zero(gen._ptr)
__pyx_r = mus_is_one_zero(__pyx_v_gen->_ptr); goto __pyx_L0;
3151:
3152: # # make def for *args. are there other ways
3153:
+3154: def make_two_pole(frequency=None, radius=None, **kwargs):
/* Python wrapper */ static PyObject *__pyx_pw_8pysndlib_3clm_311make_two_pole(PyObject *__pyx_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_310make_two_pole, "\n return a new two_pole filter: y(n) = a0 x(n) - b1 y(n-1) - b2 y(n-2).\n \n :param frequency: Center frequency \\in Hz\n :param radius: Radius of filter. Refers to the unit circle, so it should be between 0.0 and (less than) 1.0. \n :param kwargs: If frequency and radius not provided, these should be keyword arguments 'a0', 'b1', 'b2'\n :return: two_pole gen\n :rtype: mus_any\n "); static PyMethodDef __pyx_mdef_8pysndlib_3clm_311make_two_pole = {"make_two_pole", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_311make_two_pole, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_310make_two_pole}; static PyObject *__pyx_pw_8pysndlib_3clm_311make_two_pole(PyObject *__pyx_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { PyObject *__pyx_v_frequency = 0; PyObject *__pyx_v_radius = 0; PyObject *__pyx_v_kwargs = 0; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("make_two_pole (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_MACROS __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); __pyx_v_kwargs = PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return NULL; __Pyx_GOTREF(__pyx_v_kwargs); { PyObject **__pyx_pyargnames[] = {&__pyx_n_s_frequency,&__pyx_n_s_radius,0}; PyObject* values[2] = {0,0}; values[0] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None)); values[1] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None)); if (__pyx_kwds) { Py_ssize_t kw_args; switch (__pyx_nargs) { case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); CYTHON_FALLTHROUGH; case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); switch (__pyx_nargs) { case 0: if (kw_args > 0) { PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_frequency); if (value) { values[0] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3154, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 1: if (kw_args > 0) { PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_radius); if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3154, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { const Py_ssize_t kwd_pos_args = __pyx_nargs; if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, __pyx_v_kwargs, values + 0, kwd_pos_args, "make_two_pole") < 0)) __PYX_ERR(0, 3154, __pyx_L3_error) } } else { switch (__pyx_nargs) { case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); CYTHON_FALLTHROUGH; case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } } __pyx_v_frequency = values[0]; __pyx_v_radius = values[1]; } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("make_two_pole", 0, 0, 2, __pyx_nargs); __PYX_ERR(0, 3154, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; { Py_ssize_t __pyx_temp; for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); } } __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0; __Pyx_AddTraceback("pysndlib.clm.make_two_pole", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_8pysndlib_3clm_310make_two_pole(__pyx_self, __pyx_v_frequency, __pyx_v_radius, __pyx_v_kwargs); /* function exit code */ __Pyx_DECREF(__pyx_v_kwargs); { Py_ssize_t __pyx_temp; for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); } } __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_8pysndlib_3clm_310make_two_pole(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_frequency, PyObject *__pyx_v_radius, PyObject *__pyx_v_kwargs) { PyObject *__pyx_r = NULL; /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); __Pyx_AddTraceback("pysndlib.clm.make_two_pole", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__412 = PyTuple_Pack(3, __pyx_n_s_frequency, __pyx_n_s_radius, __pyx_n_s_kwargs); if (unlikely(!__pyx_tuple__412)) __PYX_ERR(0, 3154, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__412); __Pyx_GIVEREF(__pyx_tuple__412); /* … */ __pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_311make_two_pole, 0, __pyx_n_s_make_two_pole, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__413)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 3154, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_40); __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_40, __pyx_tuple__120); if (PyDict_SetItem(__pyx_d, __pyx_n_s_make_two_pole, __pyx_t_40) < 0) __PYX_ERR(0, 3154, __pyx_L1_error) __Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0; __pyx_codeobj__413 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_VARKEYWORDS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__412, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_make_two_pole, 3154, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__413)) __PYX_ERR(0, 3154, __pyx_L1_error)
3155: """
3156: return a new two_pole filter: y(n) = a0 x(n) - b1 y(n-1) - b2 y(n-2).
3157:
3158: :param frequency: Center frequency \in Hz
3159: :param radius: Radius of filter. Refers to the unit circle, so it should be between 0.0 and (less than) 1.0.
3160: :param kwargs: If frequency and radius not provided, these should be keyword arguments 'a0', 'b1', 'b2'
3161: :return: two_pole gen
3162: :rtype: mus_any
3163: """
3164:
+3165: if kwargs:
__pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_kwargs); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 3165, __pyx_L1_error) if (__pyx_t_1) { /* … */ }
+3166: if 'a0' in kwargs and 'b1' in kwargs and 'b2' in kwargs:
__pyx_t_2 = (__Pyx_PyDict_ContainsTF(__pyx_n_s_a0, __pyx_v_kwargs, Py_EQ)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 3166, __pyx_L1_error) if (__pyx_t_2) { } else { __pyx_t_1 = __pyx_t_2; goto __pyx_L5_bool_binop_done; } __pyx_t_2 = (__Pyx_PyDict_ContainsTF(__pyx_n_s_b1, __pyx_v_kwargs, Py_EQ)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 3166, __pyx_L1_error) if (__pyx_t_2) { } else { __pyx_t_1 = __pyx_t_2; goto __pyx_L5_bool_binop_done; } __pyx_t_2 = (__Pyx_PyDict_ContainsTF(__pyx_n_s_b2, __pyx_v_kwargs, Py_EQ)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 3166, __pyx_L1_error) __pyx_t_1 = __pyx_t_2; __pyx_L5_bool_binop_done:; if (likely(__pyx_t_1)) { /* … */ }
+3167: return mus_any.from_ptr(cclm.mus_make_two_pole(kwargs.get('a0'), kwargs.get('b1'), kwargs.get('b2')))
__Pyx_XDECREF(__pyx_r); __pyx_t_3 = __Pyx_PyDict_GetItemDefault(__pyx_v_kwargs, __pyx_n_s_a0, Py_None); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3167, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_4 == ((mus_float_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 3167, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = __Pyx_PyDict_GetItemDefault(__pyx_v_kwargs, __pyx_n_s_b1, Py_None); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3167, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_5 == ((mus_float_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 3167, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = __Pyx_PyDict_GetItemDefault(__pyx_v_kwargs, __pyx_n_s_b2, Py_None); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3167, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_6 == ((mus_float_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 3167, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = ((PyObject *)__pyx_vtabptr_8pysndlib_3clm_mus_any->from_ptr(mus_make_two_pole(__pyx_t_4, __pyx_t_5, __pyx_t_6), NULL)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3167, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_r = __pyx_t_3; __pyx_t_3 = 0; goto __pyx_L0;
3168: else:
+3169: raise KeyError(f'Filter needs values for a0, b1, b2')
/*else*/ {
__pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_KeyError, __pyx_tuple__39, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3169, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__Pyx_Raise(__pyx_t_3, 0, 0, 0);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__PYX_ERR(0, 3169, __pyx_L1_error)
}
/* … */
__pyx_tuple__39 = PyTuple_Pack(1, __pyx_kp_u_Filter_needs_values_for_a0_b1_b2); if (unlikely(!__pyx_tuple__39)) __PYX_ERR(0, 3169, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__39);
__Pyx_GIVEREF(__pyx_tuple__39);
3170:
3171: else:
+3172: if frequency is not None and radius is not None:
/*else*/ {
__pyx_t_2 = (__pyx_v_frequency != Py_None);
if (__pyx_t_2) {
} else {
__pyx_t_1 = __pyx_t_2;
goto __pyx_L9_bool_binop_done;
}
__pyx_t_2 = (__pyx_v_radius != Py_None);
__pyx_t_1 = __pyx_t_2;
__pyx_L9_bool_binop_done:;
if (likely(__pyx_t_1)) {
/* … */
}
+3173: return mus_any.from_ptr(cclm.mus_make_two_pole_from_frequency_and_radius(frequency, radius))
__Pyx_XDECREF(__pyx_r); __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_v_frequency); if (unlikely((__pyx_t_6 == ((mus_float_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 3173, __pyx_L1_error) __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_v_radius); if (unlikely((__pyx_t_5 == ((mus_float_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 3173, __pyx_L1_error) __pyx_t_3 = ((PyObject *)__pyx_vtabptr_8pysndlib_3clm_mus_any->from_ptr(mus_make_two_pole_from_frequency_and_radius(__pyx_t_6, __pyx_t_5), NULL)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3173, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_r = __pyx_t_3; __pyx_t_3 = 0; goto __pyx_L0;
3174: else:
+3175: raise RuntimeError("If not specifying coeffs, must provide frequency and radius.")
/*else*/ {
__pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__40, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3175, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__Pyx_Raise(__pyx_t_3, 0, 0, 0);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__PYX_ERR(0, 3175, __pyx_L1_error)
}
}
/* … */
__pyx_tuple__40 = PyTuple_Pack(1, __pyx_kp_s_If_not_specifying_coeffs_must_pr); if (unlikely(!__pyx_tuple__40)) __PYX_ERR(0, 3175, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__40);
__Pyx_GIVEREF(__pyx_tuple__40);
3176:
3177:
3178: #
3179: # cpdef mus_any make_two_pole(cython.double a0, cython.double b1, b2=None):
3180: # """
3181: # return a new two_pole filter: y(n) = a0 x(n) - b1 y(n-1) - b2 y(n-2).
3182: # if two values they are frequency and radius
3183: # if three they are filter coefficients 'a0', 'b1', 'b2'
3184: # """
3185: #
3186: # if b2 is None:
3187: # return mus_any.from_ptr(cclm.mus_make_two_pole_from_frequency_and_radius(a0, b1))
3188: # else:
3189: # return mus_any.from_ptr(cclm.mus_make_two_pole(a0, b1, b2))
3190:
3191:
3192:
+3193: cpdef cython.double two_pole(mus_any gen, cython.double insig):
static PyObject *__pyx_pw_8pysndlib_3clm_313two_pole(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static double __pyx_f_8pysndlib_3clm_two_pole(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, double __pyx_v_insig, CYTHON_UNUSED int __pyx_skip_dispatch) {
double __pyx_r;
/* … */
/* function exit code */
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_313two_pole(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_312two_pole, "\n two pole filter of input.\n \n :param gen: two_pole gen\n :param insig: input \n :rtype: float \n \n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_313two_pole = {"two_pole", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_313two_pole, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_312two_pole};
static PyObject *__pyx_pw_8pysndlib_3clm_313two_pole(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = 0;
double __pyx_v_insig;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("two_pole (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gen,&__pyx_n_s_insig,0};
PyObject* values[2] = {0,0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_gen)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3193, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_insig)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3193, __pyx_L3_error)
else {
__Pyx_RaiseArgtupleInvalid("two_pole", 1, 2, 2, 1); __PYX_ERR(0, 3193, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "two_pole") < 0)) __PYX_ERR(0, 3193, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 2)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
}
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)values[0]);
__pyx_v_insig = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_insig == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 3193, __pyx_L3_error)
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("two_pole", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 3193, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.two_pole", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gen), __pyx_ptype_8pysndlib_3clm_mus_any, 1, "gen", 0))) __PYX_ERR(0, 3193, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_312two_pole(__pyx_self, __pyx_v_gen, __pyx_v_insig);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_312two_pole(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, double __pyx_v_insig) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8pysndlib_3clm_two_pole(__pyx_v_gen, __pyx_v_insig, 0); if (unlikely(__pyx_t_1 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 3193, __pyx_L1_error)
__pyx_t_2 = PyFloat_FromDouble(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3193, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("pysndlib.clm.two_pole", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_313two_pole, 0, __pyx_n_s_two_pole, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__414)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 3193, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_two_pole, __pyx_t_40) < 0) __PYX_ERR(0, 3193, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
/* … */
__pyx_codeobj__414 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__380, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_two_pole, 3193, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__414)) __PYX_ERR(0, 3193, __pyx_L1_error)
3194: """
3195: two pole filter of input.
3196:
3197: :param gen: two_pole gen
3198: :param insig: input
3199: :rtype: float
3200:
3201: """
+3202: return cclm.mus_two_pole(gen._ptr, insig)
__pyx_r = mus_two_pole(__pyx_v_gen->_ptr, __pyx_v_insig); goto __pyx_L0;
3203:
+3204: cpdef bint is_two_pole(mus_any gen):
static PyObject *__pyx_pw_8pysndlib_3clm_315is_two_pole(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static int __pyx_f_8pysndlib_3clm_is_two_pole(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, CYTHON_UNUSED int __pyx_skip_dispatch) {
int __pyx_r;
/* … */
/* function exit code */
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_315is_two_pole(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_314is_two_pole, "\n returns True if gen is a two_pole.\n \n :param gen: gen\n :rtype: bool\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_315is_two_pole = {"is_two_pole", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_315is_two_pole, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_314is_two_pole};
static PyObject *__pyx_pw_8pysndlib_3clm_315is_two_pole(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("is_two_pole (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gen,0};
PyObject* values[1] = {0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_gen)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3204, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "is_two_pole") < 0)) __PYX_ERR(0, 3204, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 1)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
}
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)values[0]);
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("is_two_pole", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 3204, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.is_two_pole", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gen), __pyx_ptype_8pysndlib_3clm_mus_any, 1, "gen", 0))) __PYX_ERR(0, 3204, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_314is_two_pole(__pyx_self, __pyx_v_gen);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_314is_two_pole(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8pysndlib_3clm_is_two_pole(__pyx_v_gen, 0); if (unlikely(__pyx_t_1 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3204, __pyx_L1_error)
__pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3204, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("pysndlib.clm.is_two_pole", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_315is_two_pole, 0, __pyx_n_s_is_two_pole, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__415)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 3204, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_is_two_pole, __pyx_t_40) < 0) __PYX_ERR(0, 3204, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
/* … */
__pyx_codeobj__415 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__56, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_is_two_pole, 3204, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__415)) __PYX_ERR(0, 3204, __pyx_L1_error)
3205: """
3206: returns True if gen is a two_pole.
3207:
3208: :param gen: gen
3209: :rtype: bool
3210: """
+3211: return cclm.mus_is_two_pole(gen._ptr)
__pyx_r = mus_is_two_pole(__pyx_v_gen->_ptr); goto __pyx_L0;
3212:
3213: # make def for *args. are there other ways
3214:
+3215: def make_two_zero(frequency=None, radius=None, **kwargs):
/* Python wrapper */ static PyObject *__pyx_pw_8pysndlib_3clm_317make_two_zero(PyObject *__pyx_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_316make_two_zero, "\n return a new two_zero filter: y(n) = a0 x(n) + a1 x(n-1) + a2 x(n-2).\n \n :param frequency: Center frequency \\in Hz\n :param radius: Radius of filter. Refers to the unit circle, so it should be between 0.0 and (less than) 1.0. \n :param kwargs: If frequency and radius not provided, these should be keyword arguments 'a0', 'a1', 'a2'\n :return: two_zero gen\n :rtype: mus_any\n "); static PyMethodDef __pyx_mdef_8pysndlib_3clm_317make_two_zero = {"make_two_zero", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_317make_two_zero, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_316make_two_zero}; static PyObject *__pyx_pw_8pysndlib_3clm_317make_two_zero(PyObject *__pyx_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { PyObject *__pyx_v_frequency = 0; PyObject *__pyx_v_radius = 0; PyObject *__pyx_v_kwargs = 0; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("make_two_zero (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_MACROS __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); __pyx_v_kwargs = PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return NULL; __Pyx_GOTREF(__pyx_v_kwargs); { PyObject **__pyx_pyargnames[] = {&__pyx_n_s_frequency,&__pyx_n_s_radius,0}; PyObject* values[2] = {0,0}; values[0] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None)); values[1] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None)); if (__pyx_kwds) { Py_ssize_t kw_args; switch (__pyx_nargs) { case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); CYTHON_FALLTHROUGH; case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); switch (__pyx_nargs) { case 0: if (kw_args > 0) { PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_frequency); if (value) { values[0] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3215, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 1: if (kw_args > 0) { PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_radius); if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3215, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { const Py_ssize_t kwd_pos_args = __pyx_nargs; if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, __pyx_v_kwargs, values + 0, kwd_pos_args, "make_two_zero") < 0)) __PYX_ERR(0, 3215, __pyx_L3_error) } } else { switch (__pyx_nargs) { case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); CYTHON_FALLTHROUGH; case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } } __pyx_v_frequency = values[0]; __pyx_v_radius = values[1]; } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("make_two_zero", 0, 0, 2, __pyx_nargs); __PYX_ERR(0, 3215, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; { Py_ssize_t __pyx_temp; for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); } } __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0; __Pyx_AddTraceback("pysndlib.clm.make_two_zero", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_8pysndlib_3clm_316make_two_zero(__pyx_self, __pyx_v_frequency, __pyx_v_radius, __pyx_v_kwargs); /* function exit code */ __Pyx_DECREF(__pyx_v_kwargs); { Py_ssize_t __pyx_temp; for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); } } __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_8pysndlib_3clm_316make_two_zero(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_frequency, PyObject *__pyx_v_radius, PyObject *__pyx_v_kwargs) { PyObject *__pyx_r = NULL; /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); __Pyx_AddTraceback("pysndlib.clm.make_two_zero", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_317make_two_zero, 0, __pyx_n_s_make_two_zero, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__416)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 3215, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_40); __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_40, __pyx_tuple__120); if (PyDict_SetItem(__pyx_d, __pyx_n_s_make_two_zero, __pyx_t_40) < 0) __PYX_ERR(0, 3215, __pyx_L1_error) __Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0; /* … */ __pyx_codeobj__416 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_VARKEYWORDS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__412, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_make_two_zero, 3215, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__416)) __PYX_ERR(0, 3215, __pyx_L1_error)
3216: """
3217: return a new two_zero filter: y(n) = a0 x(n) + a1 x(n-1) + a2 x(n-2).
3218:
3219: :param frequency: Center frequency \in Hz
3220: :param radius: Radius of filter. Refers to the unit circle, so it should be between 0.0 and (less than) 1.0.
3221: :param kwargs: If frequency and radius not provided, these should be keyword arguments 'a0', 'a1', 'a2'
3222: :return: two_zero gen
3223: :rtype: mus_any
3224: """
3225:
+3226: if kwargs:
__pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_kwargs); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 3226, __pyx_L1_error) if (__pyx_t_1) { /* … */ }
+3227: if 'a0' in kwargs and 'a1' in kwargs and 'a1' in kwargs:
__pyx_t_2 = (__Pyx_PyDict_ContainsTF(__pyx_n_s_a0, __pyx_v_kwargs, Py_EQ)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 3227, __pyx_L1_error) if (__pyx_t_2) { } else { __pyx_t_1 = __pyx_t_2; goto __pyx_L5_bool_binop_done; } __pyx_t_2 = (__Pyx_PyDict_ContainsTF(__pyx_n_s_a1, __pyx_v_kwargs, Py_EQ)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 3227, __pyx_L1_error) if (__pyx_t_2) { } else { __pyx_t_1 = __pyx_t_2; goto __pyx_L5_bool_binop_done; } __pyx_t_2 = (__Pyx_PyDict_ContainsTF(__pyx_n_s_a1, __pyx_v_kwargs, Py_EQ)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 3227, __pyx_L1_error) __pyx_t_1 = __pyx_t_2; __pyx_L5_bool_binop_done:; if (likely(__pyx_t_1)) { /* … */ }
+3228: return mus_any.from_ptr(cclm.mus_make_two_zero(kwargs.get('a0'), kwargs.get('a1'), kwargs.get('a2')))
__Pyx_XDECREF(__pyx_r); __pyx_t_3 = __Pyx_PyDict_GetItemDefault(__pyx_v_kwargs, __pyx_n_s_a0, Py_None); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3228, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_4 == ((mus_float_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 3228, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = __Pyx_PyDict_GetItemDefault(__pyx_v_kwargs, __pyx_n_s_a1, Py_None); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3228, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_5 == ((mus_float_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 3228, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = __Pyx_PyDict_GetItemDefault(__pyx_v_kwargs, __pyx_n_s_a2, Py_None); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3228, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_6 == ((mus_float_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 3228, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = ((PyObject *)__pyx_vtabptr_8pysndlib_3clm_mus_any->from_ptr(mus_make_two_zero(__pyx_t_4, __pyx_t_5, __pyx_t_6), NULL)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3228, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_r = __pyx_t_3; __pyx_t_3 = 0; goto __pyx_L0;
3229: else:
+3230: raise KeyError(f'Filter needs values for a0, a1, a2')
/*else*/ {
__pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_KeyError, __pyx_tuple__41, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3230, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__Pyx_Raise(__pyx_t_3, 0, 0, 0);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__PYX_ERR(0, 3230, __pyx_L1_error)
}
/* … */
__pyx_tuple__41 = PyTuple_Pack(1, __pyx_kp_u_Filter_needs_values_for_a0_a1_a2); if (unlikely(!__pyx_tuple__41)) __PYX_ERR(0, 3230, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__41);
__Pyx_GIVEREF(__pyx_tuple__41);
3231:
3232: else:
+3233: if frequency is not None and radius is not None:
/*else*/ {
__pyx_t_2 = (__pyx_v_frequency != Py_None);
if (__pyx_t_2) {
} else {
__pyx_t_1 = __pyx_t_2;
goto __pyx_L9_bool_binop_done;
}
__pyx_t_2 = (__pyx_v_radius != Py_None);
__pyx_t_1 = __pyx_t_2;
__pyx_L9_bool_binop_done:;
if (likely(__pyx_t_1)) {
/* … */
}
+3234: return mus_any.from_ptr(cclm.mus_make_two_zero_from_frequency_and_radius(frequency, radius))
__Pyx_XDECREF(__pyx_r); __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_v_frequency); if (unlikely((__pyx_t_6 == ((mus_float_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 3234, __pyx_L1_error) __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_v_radius); if (unlikely((__pyx_t_5 == ((mus_float_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 3234, __pyx_L1_error) __pyx_t_3 = ((PyObject *)__pyx_vtabptr_8pysndlib_3clm_mus_any->from_ptr(mus_make_two_zero_from_frequency_and_radius(__pyx_t_6, __pyx_t_5), NULL)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3234, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_r = __pyx_t_3; __pyx_t_3 = 0; goto __pyx_L0;
3235: else:
+3236: raise RuntimeError("If not specifying coeffs, must provide frequency and radius.")
/*else*/ {
__pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__40, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3236, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__Pyx_Raise(__pyx_t_3, 0, 0, 0);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__PYX_ERR(0, 3236, __pyx_L1_error)
}
}
3237:
3238: # cpdef mus_any make_two_zero(cython.double a0, cython.double a1, a2=None):
3239: # """
3240: # return a new two_zero filter: y(n) = a0 x(n) + a1 x(n-1) + a2 x(n-2).
3241: # if two values they are frequency and radius
3242: # if three they are filter coefficients 'a0', 'b1', 'b2'
3243: # """
3244: #
3245: # if a2 is None:
3246: # return mus_any.from_ptr(cclm.mus_make_two_zero_from_frequency_and_radius(a0, a1))
3247: # else:
3248: # return mus_any.from_ptr(cclm.mus_make_two_zero(a0, a1, a2))
3249:
3250:
3251:
+3252: cpdef cython.double two_zero(mus_any gen, cython.double insig):
static PyObject *__pyx_pw_8pysndlib_3clm_319two_zero(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static double __pyx_f_8pysndlib_3clm_two_zero(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, double __pyx_v_insig, CYTHON_UNUSED int __pyx_skip_dispatch) {
double __pyx_r;
/* … */
/* function exit code */
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_319two_zero(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_318two_zero, "\n two zero filter of input. \n \n :param gen: two_zero gen\n :param insig: input \n :rtype: float \n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_319two_zero = {"two_zero", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_319two_zero, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_318two_zero};
static PyObject *__pyx_pw_8pysndlib_3clm_319two_zero(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = 0;
double __pyx_v_insig;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("two_zero (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gen,&__pyx_n_s_insig,0};
PyObject* values[2] = {0,0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_gen)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3252, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_insig)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3252, __pyx_L3_error)
else {
__Pyx_RaiseArgtupleInvalid("two_zero", 1, 2, 2, 1); __PYX_ERR(0, 3252, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "two_zero") < 0)) __PYX_ERR(0, 3252, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 2)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
}
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)values[0]);
__pyx_v_insig = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_insig == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 3252, __pyx_L3_error)
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("two_zero", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 3252, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.two_zero", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gen), __pyx_ptype_8pysndlib_3clm_mus_any, 1, "gen", 0))) __PYX_ERR(0, 3252, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_318two_zero(__pyx_self, __pyx_v_gen, __pyx_v_insig);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_318two_zero(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, double __pyx_v_insig) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8pysndlib_3clm_two_zero(__pyx_v_gen, __pyx_v_insig, 0); if (unlikely(__pyx_t_1 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 3252, __pyx_L1_error)
__pyx_t_2 = PyFloat_FromDouble(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3252, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("pysndlib.clm.two_zero", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_319two_zero, 0, __pyx_n_s_two_zero, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__417)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 3252, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_two_zero, __pyx_t_40) < 0) __PYX_ERR(0, 3252, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
/* … */
__pyx_codeobj__417 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__380, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_two_zero, 3252, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__417)) __PYX_ERR(0, 3252, __pyx_L1_error)
3253: """
3254: two zero filter of input.
3255:
3256: :param gen: two_zero gen
3257: :param insig: input
3258: :rtype: float
3259: """
+3260: return cclm.mus_two_zero(gen._ptr, insig)
__pyx_r = mus_two_zero(__pyx_v_gen->_ptr, __pyx_v_insig); goto __pyx_L0;
3261:
+3262: cpdef bint is_two_zero(mus_any gen):
static PyObject *__pyx_pw_8pysndlib_3clm_321is_two_zero(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static int __pyx_f_8pysndlib_3clm_is_two_zero(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, CYTHON_UNUSED int __pyx_skip_dispatch) {
int __pyx_r;
/* … */
/* function exit code */
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_321is_two_zero(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_320is_two_zero, "\n returns True if gen is a two_zero.\n \n :param gen: gen\n :rtype: bool\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_321is_two_zero = {"is_two_zero", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_321is_two_zero, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_320is_two_zero};
static PyObject *__pyx_pw_8pysndlib_3clm_321is_two_zero(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("is_two_zero (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gen,0};
PyObject* values[1] = {0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_gen)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3262, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "is_two_zero") < 0)) __PYX_ERR(0, 3262, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 1)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
}
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)values[0]);
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("is_two_zero", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 3262, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.is_two_zero", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gen), __pyx_ptype_8pysndlib_3clm_mus_any, 1, "gen", 0))) __PYX_ERR(0, 3262, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_320is_two_zero(__pyx_self, __pyx_v_gen);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_320is_two_zero(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8pysndlib_3clm_is_two_zero(__pyx_v_gen, 0); if (unlikely(__pyx_t_1 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3262, __pyx_L1_error)
__pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3262, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("pysndlib.clm.is_two_zero", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_321is_two_zero, 0, __pyx_n_s_is_two_zero, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__418)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 3262, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_is_two_zero, __pyx_t_40) < 0) __PYX_ERR(0, 3262, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
/* … */
__pyx_codeobj__418 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__56, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_is_two_zero, 3262, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__418)) __PYX_ERR(0, 3262, __pyx_L1_error)
3263: """
3264: returns True if gen is a two_zero.
3265:
3266: :param gen: gen
3267: :rtype: bool
3268: """
+3269: return cclm.mus_is_two_zero(gen._ptr)
__pyx_r = mus_is_two_zero(__pyx_v_gen->_ptr); goto __pyx_L0;
3270:
3271:
3272:
3273:
3274: # ---------------- formant ---------------- #
+3275: cpdef mus_any make_formant(cython.double frequency, cython.double radius):
static PyObject *__pyx_pw_8pysndlib_3clm_323make_formant(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_f_8pysndlib_3clm_make_formant(double __pyx_v_frequency, double __pyx_v_radius, CYTHON_UNUSED int __pyx_skip_dispatch) {
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_r = NULL;
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_AddTraceback("pysndlib.clm.make_formant", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XGIVEREF((PyObject *)__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_323make_formant(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_322make_formant, "\n return a new formant generator (a resonator). radius sets the pole radius (in terms of the 'unit circle').\n frequency sets the resonance center frequency (hz).\n \n :param frequency: resonance center frequency \\in Hz\n :param radius: resonance width, refers to the unit circle, so it should be between 0.0 and (less than) 1.0. \n :return: formant gen\n :rtype: mus_any\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_323make_formant = {"make_formant", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_323make_formant, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_322make_formant};
static PyObject *__pyx_pw_8pysndlib_3clm_323make_formant(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
double __pyx_v_frequency;
double __pyx_v_radius;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("make_formant (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_frequency,&__pyx_n_s_radius,0};
PyObject* values[2] = {0,0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_frequency)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3275, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_radius)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3275, __pyx_L3_error)
else {
__Pyx_RaiseArgtupleInvalid("make_formant", 1, 2, 2, 1); __PYX_ERR(0, 3275, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "make_formant") < 0)) __PYX_ERR(0, 3275, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 2)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
}
__pyx_v_frequency = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_frequency == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 3275, __pyx_L3_error)
__pyx_v_radius = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_radius == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 3275, __pyx_L3_error)
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("make_formant", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 3275, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.make_formant", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_8pysndlib_3clm_322make_formant(__pyx_self, __pyx_v_frequency, __pyx_v_radius);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_322make_formant(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_frequency, double __pyx_v_radius) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = ((PyObject *)__pyx_f_8pysndlib_3clm_make_formant(__pyx_v_frequency, __pyx_v_radius, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3275, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("pysndlib.clm.make_formant", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_tuple__419 = PyTuple_Pack(2, __pyx_n_s_frequency, __pyx_n_s_radius); if (unlikely(!__pyx_tuple__419)) __PYX_ERR(0, 3275, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__419);
__Pyx_GIVEREF(__pyx_tuple__419);
/* … */
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_323make_formant, 0, __pyx_n_s_make_formant, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__420)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 3275, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_make_formant, __pyx_t_40) < 0) __PYX_ERR(0, 3275, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
__pyx_codeobj__420 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__419, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_make_formant, 3275, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__420)) __PYX_ERR(0, 3275, __pyx_L1_error)
3276: """
3277: return a new formant generator (a resonator). radius sets the pole radius (in terms of the 'unit circle').
3278: frequency sets the resonance center frequency (hz).
3279:
3280: :param frequency: resonance center frequency \in Hz
3281: :param radius: resonance width, refers to the unit circle, so it should be between 0.0 and (less than) 1.0.
3282: :return: formant gen
3283: :rtype: mus_any
3284: """
+3285: check_range('frequency', frequency, 0.0, get_srate() / 2)
__pyx_t_1 = PyFloat_FromDouble(__pyx_v_frequency); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3285, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __pyx_f_8pysndlib_3clm_get_srate(0); if (unlikely(__pyx_t_2 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 3285, __pyx_L1_error) __pyx_t_3 = PyFloat_FromDouble((__pyx_t_2 / 2.0)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3285, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_5.__pyx_n = 2; __pyx_t_5.low = __pyx_float_0_0; __pyx_t_5.high = __pyx_t_3; __pyx_t_4 = __pyx_f_8pysndlib_3clm_check_range(__pyx_n_s_frequency, __pyx_t_1, 0, &__pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3285, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3286:
+3287: return mus_any.from_ptr(cclm.mus_make_formant(frequency, radius))
__Pyx_XDECREF((PyObject *)__pyx_r); __pyx_t_4 = ((PyObject *)__pyx_vtabptr_8pysndlib_3clm_mus_any->from_ptr(mus_make_formant(__pyx_v_frequency, __pyx_v_radius), NULL)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3287, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_r = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_t_4); __pyx_t_4 = 0; goto __pyx_L0;
3288:
+3289: cpdef cython.double formant(mus_any gen, cython.double insig, radians=None):
static PyObject *__pyx_pw_8pysndlib_3clm_325formant(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static double __pyx_f_8pysndlib_3clm_formant(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, double __pyx_v_insig, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_8pysndlib_3clm_formant *__pyx_optional_args) {
PyObject *__pyx_v_radians = ((PyObject *)Py_None);
double __pyx_r;
if (__pyx_optional_args) {
if (__pyx_optional_args->__pyx_n > 0) {
__pyx_v_radians = __pyx_optional_args->radians;
}
}
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_AddTraceback("pysndlib.clm.formant", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = -1;
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_325formant(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_324formant, "\n next sample from formant generator.\n \n :param gen: formant gen\n :param insig: input value\n :param radians: frequency \\in radians\n :rtype: float\n \n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_325formant = {"formant", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_325formant, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_324formant};
static PyObject *__pyx_pw_8pysndlib_3clm_325formant(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = 0;
double __pyx_v_insig;
PyObject *__pyx_v_radians = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("formant (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gen,&__pyx_n_s_insig,&__pyx_n_s_radians,0};
PyObject* values[3] = {0,0,0};
values[2] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_gen)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3289, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_insig)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3289, __pyx_L3_error)
else {
__Pyx_RaiseArgtupleInvalid("formant", 0, 2, 3, 1); __PYX_ERR(0, 3289, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 2:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_radians);
if (value) { values[2] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3289, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "formant") < 0)) __PYX_ERR(0, 3289, __pyx_L3_error)
}
} else {
switch (__pyx_nargs) {
case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
break;
default: goto __pyx_L5_argtuple_error;
}
}
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)values[0]);
__pyx_v_insig = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_insig == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 3289, __pyx_L3_error)
__pyx_v_radians = values[2];
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("formant", 0, 2, 3, __pyx_nargs); __PYX_ERR(0, 3289, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.formant", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gen), __pyx_ptype_8pysndlib_3clm_mus_any, 1, "gen", 0))) __PYX_ERR(0, 3289, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_324formant(__pyx_self, __pyx_v_gen, __pyx_v_insig, __pyx_v_radians);
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_324formant(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, double __pyx_v_insig, PyObject *__pyx_v_radians) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_2.__pyx_n = 1;
__pyx_t_2.radians = __pyx_v_radians;
__pyx_t_1 = __pyx_f_8pysndlib_3clm_formant(__pyx_v_gen, __pyx_v_insig, 0, &__pyx_t_2); if (unlikely(__pyx_t_1 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 3289, __pyx_L1_error)
__pyx_t_3 = PyFloat_FromDouble(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3289, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__pyx_r = __pyx_t_3;
__pyx_t_3 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_3);
__Pyx_AddTraceback("pysndlib.clm.formant", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_tuple__421 = PyTuple_Pack(3, __pyx_n_s_gen, __pyx_n_s_insig, __pyx_n_s_radians); if (unlikely(!__pyx_tuple__421)) __PYX_ERR(0, 3289, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__421);
__Pyx_GIVEREF(__pyx_tuple__421);
/* … */
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_325formant, 0, __pyx_n_s_formant, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__422)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 3289, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
__Pyx_CyFunction_SetDefaultsTuple(__pyx_t_40, __pyx_tuple__90);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_formant, __pyx_t_40) < 0) __PYX_ERR(0, 3289, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
__pyx_codeobj__422 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__421, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_formant, 3289, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__422)) __PYX_ERR(0, 3289, __pyx_L1_error)
3290: """
3291: next sample from formant generator.
3292:
3293: :param gen: formant gen
3294: :param insig: input value
3295: :param radians: frequency \in radians
3296: :rtype: float
3297:
3298: """
+3299: if radians:
__pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_radians); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 3299, __pyx_L1_error) if (__pyx_t_1) { /* … */ }
+3300: return cclm.mus_formant_with_frequency(gen._ptr, insig, radians)
__pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_v_radians); if (unlikely((__pyx_t_2 == ((mus_float_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 3300, __pyx_L1_error) __pyx_r = mus_formant_with_frequency(__pyx_v_gen->_ptr, __pyx_v_insig, __pyx_t_2); goto __pyx_L0;
3301: else:
+3302: return cclm.mus_formant(gen._ptr, insig)
/*else*/ {
__pyx_r = mus_formant(__pyx_v_gen->_ptr, __pyx_v_insig);
goto __pyx_L0;
}
3303:
+3304: cpdef bint is_formant(mus_any gen):
static PyObject *__pyx_pw_8pysndlib_3clm_327is_formant(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static int __pyx_f_8pysndlib_3clm_is_formant(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, CYTHON_UNUSED int __pyx_skip_dispatch) {
int __pyx_r;
/* … */
/* function exit code */
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_327is_formant(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_326is_formant, "\n returns True if gen is a formant.\n \n :param gen: gen\n :rtype: bool\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_327is_formant = {"is_formant", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_327is_formant, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_326is_formant};
static PyObject *__pyx_pw_8pysndlib_3clm_327is_formant(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("is_formant (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gen,0};
PyObject* values[1] = {0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_gen)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3304, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "is_formant") < 0)) __PYX_ERR(0, 3304, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 1)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
}
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)values[0]);
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("is_formant", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 3304, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.is_formant", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gen), __pyx_ptype_8pysndlib_3clm_mus_any, 1, "gen", 0))) __PYX_ERR(0, 3304, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_326is_formant(__pyx_self, __pyx_v_gen);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_326is_formant(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8pysndlib_3clm_is_formant(__pyx_v_gen, 0); if (unlikely(__pyx_t_1 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3304, __pyx_L1_error)
__pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3304, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("pysndlib.clm.is_formant", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_327is_formant, 0, __pyx_n_s_is_formant, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__423)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 3304, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_is_formant, __pyx_t_40) < 0) __PYX_ERR(0, 3304, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
/* … */
__pyx_codeobj__423 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__56, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_is_formant, 3304, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__423)) __PYX_ERR(0, 3304, __pyx_L1_error)
3305: """
3306: returns True if gen is a formant.
3307:
3308: :param gen: gen
3309: :rtype: bool
3310: """
+3311: return cclm.mus_is_formant(gen._ptr)
__pyx_r = mus_is_formant(__pyx_v_gen->_ptr); goto __pyx_L0;
3312:
3313: # ---------------- formant-bank ---------------- #
+3314: cpdef mus_any make_formant_bank(list filters, amps=None):
static PyObject *__pyx_pw_8pysndlib_3clm_329make_formant_bank(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_f_8pysndlib_3clm_make_formant_bank(PyObject *__pyx_v_filters, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_8pysndlib_3clm_make_formant_bank *__pyx_optional_args) {
PyObject *__pyx_v_amps = ((PyObject *)Py_None);
PyObject *__pyx_v_p = NULL;
__Pyx_memviewslice __pyx_v_amps_view = { 0, 0, { 0 }, { 0 }, { 0 } };
struct __pyx_obj_8pysndlib_3clm_mus_any_array *__pyx_v_filt_array = NULL;
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = NULL;
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_r = NULL;
if (__pyx_optional_args) {
if (__pyx_optional_args->__pyx_n > 0) {
__pyx_v_amps = __pyx_optional_args->amps;
}
}
__Pyx_INCREF(__pyx_v_amps);
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__PYX_XCLEAR_MEMVIEW(&__pyx_t_5, 1);
__Pyx_XDECREF(__pyx_t_6);
__Pyx_AddTraceback("pysndlib.clm.make_formant_bank", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XDECREF(__pyx_v_p);
__PYX_XCLEAR_MEMVIEW(&__pyx_v_amps_view, 1);
__Pyx_XDECREF((PyObject *)__pyx_v_filt_array);
__Pyx_XDECREF((PyObject *)__pyx_v_gen);
__Pyx_XDECREF(__pyx_v_amps);
__Pyx_XGIVEREF((PyObject *)__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_329make_formant_bank(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_328make_formant_bank, "\n return a new formant-bank generator.\n \n :param filters: list of filter gens\n :param amps: list of amps to apply to filters\n :return: formant_bank gen\n :rtype: mus_any\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_329make_formant_bank = {"make_formant_bank", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_329make_formant_bank, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_328make_formant_bank};
static PyObject *__pyx_pw_8pysndlib_3clm_329make_formant_bank(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
PyObject *__pyx_v_filters = 0;
PyObject *__pyx_v_amps = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("make_formant_bank (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_filters,&__pyx_n_s_amps,0};
PyObject* values[2] = {0,0};
values[1] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_filters)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3314, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_amps);
if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3314, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "make_formant_bank") < 0)) __PYX_ERR(0, 3314, __pyx_L3_error)
}
} else {
switch (__pyx_nargs) {
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
break;
default: goto __pyx_L5_argtuple_error;
}
}
__pyx_v_filters = ((PyObject*)values[0]);
__pyx_v_amps = values[1];
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("make_formant_bank", 0, 1, 2, __pyx_nargs); __PYX_ERR(0, 3314, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.make_formant_bank", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_filters), (&PyList_Type), 1, "filters", 1))) __PYX_ERR(0, 3314, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_328make_formant_bank(__pyx_self, __pyx_v_filters, __pyx_v_amps);
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_328make_formant_bank(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_filters, PyObject *__pyx_v_amps) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_2.__pyx_n = 1;
__pyx_t_2.amps = __pyx_v_amps;
__pyx_t_1 = ((PyObject *)__pyx_f_8pysndlib_3clm_make_formant_bank(__pyx_v_filters, 0, &__pyx_t_2)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3314, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("pysndlib.clm.make_formant_bank", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_tuple__424 = PyTuple_Pack(2, __pyx_n_s_filters, __pyx_n_s_amps); if (unlikely(!__pyx_tuple__424)) __PYX_ERR(0, 3314, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__424);
__Pyx_GIVEREF(__pyx_tuple__424);
/* … */
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_329make_formant_bank, 0, __pyx_n_s_make_formant_bank, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__425)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 3314, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
__Pyx_CyFunction_SetDefaultsTuple(__pyx_t_40, __pyx_tuple__90);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_make_formant_bank, __pyx_t_40) < 0) __PYX_ERR(0, 3314, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
__pyx_codeobj__425 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__424, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_make_formant_bank, 3314, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__425)) __PYX_ERR(0, 3314, __pyx_L1_error)
/* … */
struct __pyx_opt_args_8pysndlib_3clm_make_formant_bank {
int __pyx_n;
PyObject *amps;
};
3315: """
3316: return a new formant-bank generator.
3317:
3318: :param filters: list of filter gens
3319: :param amps: list of amps to apply to filters
3320: :return: formant_bank gen
3321: :rtype: mus_any
3322: """
3323:
+3324: p = list(map(is_formant, filters))
__Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_is_formant); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3324, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3324, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_GIVEREF(__pyx_t_1); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1)) __PYX_ERR(0, 3324, __pyx_L1_error); __Pyx_INCREF(__pyx_v_filters); __Pyx_GIVEREF(__pyx_v_filters); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_filters)) __PYX_ERR(0, 3324, __pyx_L1_error); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_map, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3324, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_PySequence_ListKeepNew(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3324, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_p = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0;
3325:
+3326: if not all(p):
__pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_all, __pyx_v_p); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3326, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 3326, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_4 = (!__pyx_t_3); if (unlikely(__pyx_t_4)) { /* … */ }
+3327: raise TypeError(f'filter list contains at least one element that is not a formant.')
__pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__42, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3327, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __PYX_ERR(0, 3327, __pyx_L1_error) /* … */ __pyx_tuple__42 = PyTuple_Pack(1, __pyx_kp_u_filter_list_contains_at_least_on); if (unlikely(!__pyx_tuple__42)) __PYX_ERR(0, 3327, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__42); __Pyx_GIVEREF(__pyx_tuple__42);
3328:
+3329: cdef double [:] amps_view = None
__pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(Py_None, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(0, 3329, __pyx_L1_error) __pyx_v_amps_view = __pyx_t_5; __pyx_t_5.memview = NULL; __pyx_t_5.data = NULL;
3330:
+3331: filt_array = mus_any_array.from_pylist(filters)
__pyx_t_2 = ((PyObject *)__pyx_f_8pysndlib_3clm_13mus_any_array_from_pylist(__pyx_v_filters)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3331, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_v_filt_array = ((struct __pyx_obj_8pysndlib_3clm_mus_any_array *)__pyx_t_2); __pyx_t_2 = 0;
3332:
+3333: if amps is not None:
__pyx_t_4 = (__pyx_v_amps != Py_None);
if (__pyx_t_4) {
/* … */
goto __pyx_L4;
}
+3334: if isinstance(amps, list):
__pyx_t_4 = PyList_Check(__pyx_v_amps);
if (__pyx_t_4) {
/* … */
}
+3335: amps = np.array(amps)
__Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3335, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_array); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3335, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = NULL; __pyx_t_7 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_6))) { __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_6); if (likely(__pyx_t_1)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); __Pyx_INCREF(__pyx_t_1); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_6, function); __pyx_t_7 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_v_amps}; __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7); __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3335, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; } __Pyx_DECREF_SET(__pyx_v_amps, __pyx_t_2); __pyx_t_2 = 0;
+3336: amps_view = amps
__pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_v_amps, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(0, 3336, __pyx_L1_error) __PYX_XCLEAR_MEMVIEW(&__pyx_v_amps_view, 1); __pyx_v_amps_view = __pyx_t_5; __pyx_t_5.memview = NULL; __pyx_t_5.data = NULL;
+3337: gen = mus_any.from_ptr(cclm.mus_make_formant_bank(len(filters),filt_array.data, &s_view[0]))
if (unlikely(__pyx_v_filters == Py_None)) {
PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
__PYX_ERR(0, 3337, __pyx_L1_error)
}
__pyx_t_8 = __Pyx_PyList_GET_SIZE(__pyx_v_filters); if (unlikely(__pyx_t_8 == ((Py_ssize_t)-1))) __PYX_ERR(0, 3337, __pyx_L1_error)
__pyx_t_9 = 0;
__pyx_t_7 = -1;
if (__pyx_t_9 < 0) {
__pyx_t_9 += __pyx_v_amps_view.shape[0];
if (unlikely(__pyx_t_9 < 0)) __pyx_t_7 = 0;
} else if (unlikely(__pyx_t_9 >= __pyx_v_amps_view.shape[0])) __pyx_t_7 = 0;
if (unlikely(__pyx_t_7 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_7);
__PYX_ERR(0, 3337, __pyx_L1_error)
}
__pyx_t_2 = ((PyObject *)__pyx_vtabptr_8pysndlib_3clm_mus_any->from_ptr(mus_make_formant_bank(__pyx_t_8, __pyx_v_filt_array->data, (&(*((double *) ( /* dim=0 */ (__pyx_v_amps_view.data + __pyx_t_9 * __pyx_v_amps_view.strides[0]) ))))), NULL)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3337, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_t_2);
__pyx_t_2 = 0;
3338: else:
+3339: gen = mus_any.from_ptr(cclm.mus_make_formant_bank(len(filters),filt_array.data, NULL))
/*else*/ {
if (unlikely(__pyx_v_filters == Py_None)) {
PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
__PYX_ERR(0, 3339, __pyx_L1_error)
}
__pyx_t_8 = __Pyx_PyList_GET_SIZE(__pyx_v_filters); if (unlikely(__pyx_t_8 == ((Py_ssize_t)-1))) __PYX_ERR(0, 3339, __pyx_L1_error)
__pyx_t_2 = ((PyObject *)__pyx_vtabptr_8pysndlib_3clm_mus_any->from_ptr(mus_make_formant_bank(__pyx_t_8, __pyx_v_filt_array->data, NULL), NULL)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3339, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_t_2);
__pyx_t_2 = 0;
}
__pyx_L4:;
+3340: gen.cache_extend([filt_array, amps, filters])
__pyx_t_2 = PyList_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3340, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF((PyObject *)__pyx_v_filt_array); __Pyx_GIVEREF((PyObject *)__pyx_v_filt_array); if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_filt_array))) __PYX_ERR(0, 3340, __pyx_L1_error); __Pyx_INCREF(__pyx_v_amps); __Pyx_GIVEREF(__pyx_v_amps); if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 1, __pyx_v_amps)) __PYX_ERR(0, 3340, __pyx_L1_error); __Pyx_INCREF(__pyx_v_filters); __Pyx_GIVEREF(__pyx_v_filters); if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 2, __pyx_v_filters)) __PYX_ERR(0, 3340, __pyx_L1_error); __pyx_t_6 = ((struct __pyx_vtabstruct_8pysndlib_3clm_mus_any *)__pyx_v_gen->__pyx_vtab)->cache_extend(__pyx_v_gen, __pyx_t_2, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3340, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+3341: return gen
__Pyx_XDECREF((PyObject *)__pyx_r); __Pyx_INCREF((PyObject *)__pyx_v_gen); __pyx_r = __pyx_v_gen; goto __pyx_L0;
3342:
3343:
+3344: cpdef cython.double formant_bank(mus_any gen, inputs):
static PyObject *__pyx_pw_8pysndlib_3clm_331formant_bank(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static double __pyx_f_8pysndlib_3clm_formant_bank(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, PyObject *__pyx_v_inputs, CYTHON_UNUSED int __pyx_skip_dispatch) {
__Pyx_memviewslice __pyx_v_inputs_view = { 0, 0, { 0 }, { 0 }, { 0 } };
PyObject *__pyx_v_res = NULL;
double __pyx_r;
/* … */
/* function exit code */
__pyx_L1_error:;
__PYX_XCLEAR_MEMVIEW(&__pyx_t_1, 1);
__Pyx_XDECREF(__pyx_t_5);
__Pyx_AddTraceback("pysndlib.clm.formant_bank", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = -1;
__pyx_L0:;
__PYX_XCLEAR_MEMVIEW(&__pyx_v_inputs_view, 1);
__Pyx_XDECREF(__pyx_v_res);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_331formant_bank(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_330formant_bank, "\n sum a bank of formant generators.\n \n :param gen: formant_bank gen\n :param inputs: can be a list/array of inputs or a single input\n :rtype: float\n \n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_331formant_bank = {"formant_bank", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_331formant_bank, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_330formant_bank};
static PyObject *__pyx_pw_8pysndlib_3clm_331formant_bank(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = 0;
PyObject *__pyx_v_inputs = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("formant_bank (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gen,&__pyx_n_s_inputs,0};
PyObject* values[2] = {0,0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_gen)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3344, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_inputs)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3344, __pyx_L3_error)
else {
__Pyx_RaiseArgtupleInvalid("formant_bank", 1, 2, 2, 1); __PYX_ERR(0, 3344, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "formant_bank") < 0)) __PYX_ERR(0, 3344, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 2)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
}
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)values[0]);
__pyx_v_inputs = values[1];
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("formant_bank", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 3344, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.formant_bank", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gen), __pyx_ptype_8pysndlib_3clm_mus_any, 1, "gen", 0))) __PYX_ERR(0, 3344, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_330formant_bank(__pyx_self, __pyx_v_gen, __pyx_v_inputs);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_330formant_bank(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, PyObject *__pyx_v_inputs) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8pysndlib_3clm_formant_bank(__pyx_v_gen, __pyx_v_inputs, 0); if (unlikely(__pyx_t_1 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 3344, __pyx_L1_error)
__pyx_t_2 = PyFloat_FromDouble(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3344, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("pysndlib.clm.formant_bank", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_tuple__426 = PyTuple_Pack(2, __pyx_n_s_gen, __pyx_n_s_inputs); if (unlikely(!__pyx_tuple__426)) __PYX_ERR(0, 3344, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__426);
__Pyx_GIVEREF(__pyx_tuple__426);
/* … */
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_331formant_bank, 0, __pyx_n_s_formant_bank, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__427)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 3344, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_formant_bank, __pyx_t_40) < 0) __PYX_ERR(0, 3344, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
__pyx_codeobj__427 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__426, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_formant_bank, 3344, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__427)) __PYX_ERR(0, 3344, __pyx_L1_error)
3345: """
3346: sum a bank of formant generators.
3347:
3348: :param gen: formant_bank gen
3349: :param inputs: can be a list/array of inputs or a single input
3350: :rtype: float
3351:
3352: """
3353:
+3354: cdef double [:] inputs_view = None
__pyx_t_1 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(Py_None, PyBUF_WRITABLE); if (unlikely(!__pyx_t_1.memview)) __PYX_ERR(0, 3354, __pyx_L1_error) __pyx_v_inputs_view = __pyx_t_1; __pyx_t_1.memview = NULL; __pyx_t_1.data = NULL;
3355:
+3356: if isinstance(inputs, np.ndarray):
__pyx_t_2 = __Pyx_TypeCheck(__pyx_v_inputs, __pyx_ptype_5numpy_ndarray);
if (__pyx_t_2) {
/* … */
}
+3357: inputs_view = inputs
__pyx_t_1 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_v_inputs, PyBUF_WRITABLE); if (unlikely(!__pyx_t_1.memview)) __PYX_ERR(0, 3357, __pyx_L1_error) __PYX_XCLEAR_MEMVIEW(&__pyx_v_inputs_view, 1); __pyx_v_inputs_view = __pyx_t_1; __pyx_t_1.memview = NULL; __pyx_t_1.data = NULL;
+3358: res = cclm.mus_formant_bank_with_inputs(gen._ptr, &inputs_view[0])
__pyx_t_3 = 0;
__pyx_t_4 = -1;
if (__pyx_t_3 < 0) {
__pyx_t_3 += __pyx_v_inputs_view.shape[0];
if (unlikely(__pyx_t_3 < 0)) __pyx_t_4 = 0;
} else if (unlikely(__pyx_t_3 >= __pyx_v_inputs_view.shape[0])) __pyx_t_4 = 0;
if (unlikely(__pyx_t_4 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_4);
__PYX_ERR(0, 3358, __pyx_L1_error)
}
__pyx_t_5 = PyFloat_FromDouble(mus_formant_bank_with_inputs(__pyx_v_gen->_ptr, (&(*((double *) ( /* dim=0 */ (__pyx_v_inputs_view.data + __pyx_t_3 * __pyx_v_inputs_view.strides[0]) )))))); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3358, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_5);
__pyx_v_res = __pyx_t_5;
__pyx_t_5 = 0;
+3359: return res
__pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_v_res); if (unlikely((__pyx_t_6 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 3359, __pyx_L1_error) __pyx_r = __pyx_t_6; goto __pyx_L0;
3360: else:
+3361: res = cclm.mus_formant_bank(gen._ptr, inputs)
/*else*/ {
__pyx_t_7 = __pyx_PyFloat_AsDouble(__pyx_v_inputs); if (unlikely((__pyx_t_7 == ((mus_float_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 3361, __pyx_L1_error)
__pyx_t_5 = PyFloat_FromDouble(mus_formant_bank(__pyx_v_gen->_ptr, __pyx_t_7)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3361, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_5);
__pyx_v_res = __pyx_t_5;
__pyx_t_5 = 0;
}
+3362: return res
__pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_v_res); if (unlikely((__pyx_t_6 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 3362, __pyx_L1_error) __pyx_r = __pyx_t_6; goto __pyx_L0;
3363:
+3364: cpdef bint is_formant_bank(mus_any gen):
static PyObject *__pyx_pw_8pysndlib_3clm_333is_formant_bank(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static int __pyx_f_8pysndlib_3clm_is_formant_bank(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, CYTHON_UNUSED int __pyx_skip_dispatch) {
int __pyx_r;
/* … */
/* function exit code */
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_333is_formant_bank(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_332is_formant_bank, "\n returns True if gen is a formant_bank.\n \n :param gen: gen\n :rtype: bool\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_333is_formant_bank = {"is_formant_bank", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_333is_formant_bank, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_332is_formant_bank};
static PyObject *__pyx_pw_8pysndlib_3clm_333is_formant_bank(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("is_formant_bank (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gen,0};
PyObject* values[1] = {0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_gen)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3364, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "is_formant_bank") < 0)) __PYX_ERR(0, 3364, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 1)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
}
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)values[0]);
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("is_formant_bank", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 3364, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.is_formant_bank", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gen), __pyx_ptype_8pysndlib_3clm_mus_any, 1, "gen", 0))) __PYX_ERR(0, 3364, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_332is_formant_bank(__pyx_self, __pyx_v_gen);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_332is_formant_bank(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8pysndlib_3clm_is_formant_bank(__pyx_v_gen, 0); if (unlikely(__pyx_t_1 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3364, __pyx_L1_error)
__pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3364, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("pysndlib.clm.is_formant_bank", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_333is_formant_bank, 0, __pyx_n_s_is_formant_bank, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__428)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 3364, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_is_formant_bank, __pyx_t_40) < 0) __PYX_ERR(0, 3364, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
/* … */
__pyx_codeobj__428 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__56, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_is_formant_bank, 3364, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__428)) __PYX_ERR(0, 3364, __pyx_L1_error)
3365: """
3366: returns True if gen is a formant_bank.
3367:
3368: :param gen: gen
3369: :rtype: bool
3370: """
+3371: return cclm.mus_is_formant_bank(gen._ptr)
__pyx_r = mus_is_formant_bank(__pyx_v_gen->_ptr); goto __pyx_L0;
3372:
3373: # ---------------- firmant ---------------- #
+3374: cpdef mus_any make_firmant(cython.double frequency, cython.double radius):
static PyObject *__pyx_pw_8pysndlib_3clm_335make_firmant(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_f_8pysndlib_3clm_make_firmant(double __pyx_v_frequency, double __pyx_v_radius, CYTHON_UNUSED int __pyx_skip_dispatch) {
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_r = NULL;
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_AddTraceback("pysndlib.clm.make_firmant", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XGIVEREF((PyObject *)__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_335make_firmant(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_334make_firmant, "\n return a new firmant generator (a resonator). radius sets the pole radius (in terms of the 'unit\n circle'). frequency sets the resonance center frequency (hz).\n \n :param frequency: resonance center frequency \\in Hz\n :param radius: resonance width, refers to the unit circle, so it should be between 0.0 and (less than) 1.0. \n :return: formant gen\n :rtype: mus_any \n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_335make_firmant = {"make_firmant", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_335make_firmant, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_334make_firmant};
static PyObject *__pyx_pw_8pysndlib_3clm_335make_firmant(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
double __pyx_v_frequency;
double __pyx_v_radius;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("make_firmant (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_frequency,&__pyx_n_s_radius,0};
PyObject* values[2] = {0,0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_frequency)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3374, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_radius)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3374, __pyx_L3_error)
else {
__Pyx_RaiseArgtupleInvalid("make_firmant", 1, 2, 2, 1); __PYX_ERR(0, 3374, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "make_firmant") < 0)) __PYX_ERR(0, 3374, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 2)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
}
__pyx_v_frequency = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_frequency == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 3374, __pyx_L3_error)
__pyx_v_radius = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_radius == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 3374, __pyx_L3_error)
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("make_firmant", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 3374, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.make_firmant", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_8pysndlib_3clm_334make_firmant(__pyx_self, __pyx_v_frequency, __pyx_v_radius);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_334make_firmant(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_frequency, double __pyx_v_radius) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = ((PyObject *)__pyx_f_8pysndlib_3clm_make_firmant(__pyx_v_frequency, __pyx_v_radius, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3374, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("pysndlib.clm.make_firmant", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_335make_firmant, 0, __pyx_n_s_make_firmant, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__429)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 3374, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_make_firmant, __pyx_t_40) < 0) __PYX_ERR(0, 3374, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
/* … */
__pyx_codeobj__429 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__419, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_make_firmant, 3374, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__429)) __PYX_ERR(0, 3374, __pyx_L1_error)
3375: """
3376: return a new firmant generator (a resonator). radius sets the pole radius (in terms of the 'unit
3377: circle'). frequency sets the resonance center frequency (hz).
3378:
3379: :param frequency: resonance center frequency \in Hz
3380: :param radius: resonance width, refers to the unit circle, so it should be between 0.0 and (less than) 1.0.
3381: :return: formant gen
3382: :rtype: mus_any
3383: """
+3384: check_range('frequency', frequency, 0.0, get_srate() / 2)
__pyx_t_1 = PyFloat_FromDouble(__pyx_v_frequency); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3384, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __pyx_f_8pysndlib_3clm_get_srate(0); if (unlikely(__pyx_t_2 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 3384, __pyx_L1_error) __pyx_t_3 = PyFloat_FromDouble((__pyx_t_2 / 2.0)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3384, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_5.__pyx_n = 2; __pyx_t_5.low = __pyx_float_0_0; __pyx_t_5.high = __pyx_t_3; __pyx_t_4 = __pyx_f_8pysndlib_3clm_check_range(__pyx_n_s_frequency, __pyx_t_1, 0, &__pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3384, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3385:
+3386: return mus_any.from_ptr(cclm.mus_make_firmant(frequency, radius))
__Pyx_XDECREF((PyObject *)__pyx_r); __pyx_t_4 = ((PyObject *)__pyx_vtabptr_8pysndlib_3clm_mus_any->from_ptr(mus_make_firmant(__pyx_v_frequency, __pyx_v_radius), NULL)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3386, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_r = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_t_4); __pyx_t_4 = 0; goto __pyx_L0;
3387:
+3388: cpdef firmant(mus_any gen, mus_any insig, radians=None ):
static PyObject *__pyx_pw_8pysndlib_3clm_337firmant(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyObject *__pyx_f_8pysndlib_3clm_firmant(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_insig, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_8pysndlib_3clm_firmant *__pyx_optional_args) {
PyObject *__pyx_v_radians = ((PyObject *)Py_None);
PyObject *__pyx_r = NULL;
if (__pyx_optional_args) {
if (__pyx_optional_args->__pyx_n > 0) {
__pyx_v_radians = __pyx_optional_args->radians;
}
}
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_4);
__Pyx_AddTraceback("pysndlib.clm.firmant", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_337firmant(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_336firmant, "\n next sample from resonator generator.\n \n next sample from firmant generator.\n :param gen: firmant gen\n :param insig: input value\n :param radians: frequency \\in radians\n :rtype: float\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_337firmant = {"firmant", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_337firmant, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_336firmant};
static PyObject *__pyx_pw_8pysndlib_3clm_337firmant(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = 0;
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_insig = 0;
PyObject *__pyx_v_radians = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("firmant (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gen,&__pyx_n_s_insig,&__pyx_n_s_radians,0};
PyObject* values[3] = {0,0,0};
values[2] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_gen)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3388, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_insig)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3388, __pyx_L3_error)
else {
__Pyx_RaiseArgtupleInvalid("firmant", 0, 2, 3, 1); __PYX_ERR(0, 3388, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 2:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_radians);
if (value) { values[2] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3388, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "firmant") < 0)) __PYX_ERR(0, 3388, __pyx_L3_error)
}
} else {
switch (__pyx_nargs) {
case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
break;
default: goto __pyx_L5_argtuple_error;
}
}
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)values[0]);
__pyx_v_insig = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)values[1]);
__pyx_v_radians = values[2];
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("firmant", 0, 2, 3, __pyx_nargs); __PYX_ERR(0, 3388, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.firmant", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gen), __pyx_ptype_8pysndlib_3clm_mus_any, 1, "gen", 0))) __PYX_ERR(0, 3388, __pyx_L1_error)
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_insig), __pyx_ptype_8pysndlib_3clm_mus_any, 1, "insig", 0))) __PYX_ERR(0, 3388, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_336firmant(__pyx_self, __pyx_v_gen, __pyx_v_insig, __pyx_v_radians);
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_336firmant(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_insig, PyObject *__pyx_v_radians) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_2.__pyx_n = 1;
__pyx_t_2.radians = __pyx_v_radians;
__pyx_t_1 = __pyx_f_8pysndlib_3clm_firmant(__pyx_v_gen, __pyx_v_insig, 0, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3388, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("pysndlib.clm.firmant", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_337firmant, 0, __pyx_n_s_firmant, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__430)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 3388, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
__Pyx_CyFunction_SetDefaultsTuple(__pyx_t_40, __pyx_tuple__90);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_firmant, __pyx_t_40) < 0) __PYX_ERR(0, 3388, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
/* … */
__pyx_codeobj__430 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__421, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_firmant, 3388, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__430)) __PYX_ERR(0, 3388, __pyx_L1_error)
3389: """
3390: next sample from resonator generator.
3391:
3392: next sample from firmant generator.
3393: :param gen: firmant gen
3394: :param insig: input value
3395: :param radians: frequency \in radians
3396: :rtype: float
3397: """
+3398: if radians:
__pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_radians); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 3398, __pyx_L1_error) if (__pyx_t_1) { /* … */ }
+3399: return cclm.mus_firmant_with_frequency(gen._ptr, insig, radians)
__Pyx_XDECREF(__pyx_r); __pyx_t_2 = __pyx_PyFloat_AsDouble(((PyObject *)__pyx_v_insig)); if (unlikely((__pyx_t_2 == ((mus_float_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 3399, __pyx_L1_error) __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_v_radians); if (unlikely((__pyx_t_3 == ((mus_float_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 3399, __pyx_L1_error) __pyx_t_4 = PyFloat_FromDouble(mus_firmant_with_frequency(__pyx_v_gen->_ptr, __pyx_t_2, __pyx_t_3)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3399, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_r = __pyx_t_4; __pyx_t_4 = 0; goto __pyx_L0;
3400: else:
+3401: return cclm.mus_firmant(gen._ptr, insig)
/*else*/ {
__Pyx_XDECREF(__pyx_r);
__pyx_t_3 = __pyx_PyFloat_AsDouble(((PyObject *)__pyx_v_insig)); if (unlikely((__pyx_t_3 == ((mus_float_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 3401, __pyx_L1_error)
__pyx_t_4 = PyFloat_FromDouble(mus_firmant(__pyx_v_gen->_ptr, __pyx_t_3)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3401, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
__pyx_r = __pyx_t_4;
__pyx_t_4 = 0;
goto __pyx_L0;
}
3402:
+3403: cpdef is_firmant(mus_any gen):
static PyObject *__pyx_pw_8pysndlib_3clm_339is_firmant(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyObject *__pyx_f_8pysndlib_3clm_is_firmant(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, CYTHON_UNUSED int __pyx_skip_dispatch) {
PyObject *__pyx_r = NULL;
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("pysndlib.clm.is_firmant", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_339is_firmant(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_338is_firmant, "\n returns True if gen is a firmant.\n \n :param gen: gen\n :rtype: bool\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_339is_firmant = {"is_firmant", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_339is_firmant, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_338is_firmant};
static PyObject *__pyx_pw_8pysndlib_3clm_339is_firmant(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("is_firmant (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gen,0};
PyObject* values[1] = {0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_gen)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3403, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "is_firmant") < 0)) __PYX_ERR(0, 3403, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 1)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
}
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)values[0]);
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("is_firmant", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 3403, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.is_firmant", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gen), __pyx_ptype_8pysndlib_3clm_mus_any, 1, "gen", 0))) __PYX_ERR(0, 3403, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_338is_firmant(__pyx_self, __pyx_v_gen);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_338is_firmant(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8pysndlib_3clm_is_firmant(__pyx_v_gen, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3403, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("pysndlib.clm.is_firmant", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_339is_firmant, 0, __pyx_n_s_is_firmant, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__431)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 3403, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_is_firmant, __pyx_t_40) < 0) __PYX_ERR(0, 3403, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
/* … */
__pyx_codeobj__431 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__56, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_is_firmant, 3403, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__431)) __PYX_ERR(0, 3403, __pyx_L1_error)
3404: """
3405: returns True if gen is a firmant.
3406:
3407: :param gen: gen
3408: :rtype: bool
3409: """
+3410: return cclm.mus_is_firmant(gen._ptr)
__Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyBool_FromLong(mus_is_firmant(__pyx_v_gen->_ptr)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3410, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
3411:
3412: # ---------------- filter ---------------- #
+3413: cpdef mus_any make_filter(cython.int order, xcoeffs, ycoeffs):
static PyObject *__pyx_pw_8pysndlib_3clm_341make_filter(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_f_8pysndlib_3clm_make_filter(int __pyx_v_order, PyObject *__pyx_v_xcoeffs, PyObject *__pyx_v_ycoeffs, CYTHON_UNUSED int __pyx_skip_dispatch) {
PyObject *__pyx_v_xcoeffs_cpy = NULL;
PyObject *__pyx_v_ycoeffs_cpy = NULL;
__Pyx_memviewslice __pyx_v_xcoeffs_view = { 0, 0, { 0 }, { 0 }, { 0 } };
__Pyx_memviewslice __pyx_v_ycoeffs_view = { 0, 0, { 0 }, { 0 }, { 0 } };
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = NULL;
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_r = NULL;
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_XDECREF(__pyx_t_5);
__PYX_XCLEAR_MEMVIEW(&__pyx_t_6, 1);
__Pyx_AddTraceback("pysndlib.clm.make_filter", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XDECREF(__pyx_v_xcoeffs_cpy);
__Pyx_XDECREF(__pyx_v_ycoeffs_cpy);
__PYX_XCLEAR_MEMVIEW(&__pyx_v_xcoeffs_view, 1);
__PYX_XCLEAR_MEMVIEW(&__pyx_v_ycoeffs_view, 1);
__Pyx_XDECREF((PyObject *)__pyx_v_gen);
__Pyx_XGIVEREF((PyObject *)__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_341make_filter(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_340make_filter, "\n return a new direct form fir/iir filter, coeff args are list/ndarray.\n \n :param order: filter order\n :param xcoeffs: x coeffs\n :param ycoeffs: y coeffs\n :return: filter gen\n :rtype: mus_any\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_341make_filter = {"make_filter", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_341make_filter, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_340make_filter};
static PyObject *__pyx_pw_8pysndlib_3clm_341make_filter(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
int __pyx_v_order;
PyObject *__pyx_v_xcoeffs = 0;
PyObject *__pyx_v_ycoeffs = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("make_filter (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_order,&__pyx_n_s_xcoeffs,&__pyx_n_s_ycoeffs,0};
PyObject* values[3] = {0,0,0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_order)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3413, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_xcoeffs)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3413, __pyx_L3_error)
else {
__Pyx_RaiseArgtupleInvalid("make_filter", 1, 3, 3, 1); __PYX_ERR(0, 3413, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 2:
if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_ycoeffs)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[2]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3413, __pyx_L3_error)
else {
__Pyx_RaiseArgtupleInvalid("make_filter", 1, 3, 3, 2); __PYX_ERR(0, 3413, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "make_filter") < 0)) __PYX_ERR(0, 3413, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 3)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
}
__pyx_v_order = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_order == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3413, __pyx_L3_error)
__pyx_v_xcoeffs = values[1];
__pyx_v_ycoeffs = values[2];
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("make_filter", 1, 3, 3, __pyx_nargs); __PYX_ERR(0, 3413, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.make_filter", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_8pysndlib_3clm_340make_filter(__pyx_self, __pyx_v_order, __pyx_v_xcoeffs, __pyx_v_ycoeffs);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_340make_filter(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_order, PyObject *__pyx_v_xcoeffs, PyObject *__pyx_v_ycoeffs) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = ((PyObject *)__pyx_f_8pysndlib_3clm_make_filter(__pyx_v_order, __pyx_v_xcoeffs, __pyx_v_ycoeffs, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3413, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("pysndlib.clm.make_filter", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_tuple__432 = PyTuple_Pack(3, __pyx_n_s_order, __pyx_n_s_xcoeffs, __pyx_n_s_ycoeffs); if (unlikely(!__pyx_tuple__432)) __PYX_ERR(0, 3413, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__432);
__Pyx_GIVEREF(__pyx_tuple__432);
/* … */
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_341make_filter, 0, __pyx_n_s_make_filter, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__433)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 3413, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_make_filter, __pyx_t_40) < 0) __PYX_ERR(0, 3413, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
__pyx_codeobj__433 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__432, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_make_filter, 3413, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__433)) __PYX_ERR(0, 3413, __pyx_L1_error)
3414: """
3415: return a new direct form fir/iir filter, coeff args are list/ndarray.
3416:
3417: :param order: filter order
3418: :param xcoeffs: x coeffs
3419: :param ycoeffs: y coeffs
3420: :return: filter gen
3421: :rtype: mus_any
3422: """
3423:
+3424: xcoeffs_cpy = np.array(xcoeffs, dtype=np.double)
__Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3424, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_array); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3424, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3424, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_v_xcoeffs); __Pyx_GIVEREF(__pyx_v_xcoeffs); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_xcoeffs)) __PYX_ERR(0, 3424, __pyx_L1_error); __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3424, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3424, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_double); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3424, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_dtype, __pyx_t_5) < 0) __PYX_ERR(0, 3424, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3424, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_xcoeffs_cpy = __pyx_t_5; __pyx_t_5 = 0;
+3425: ycoeffs_cpy = np.array(ycoeffs, dtype=np.double)
__Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3425, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_array); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3425, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3425, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_INCREF(__pyx_v_ycoeffs); __Pyx_GIVEREF(__pyx_v_ycoeffs); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_ycoeffs)) __PYX_ERR(0, 3425, __pyx_L1_error); __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3425, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3425, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_double); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3425, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_t_4) < 0) __PYX_ERR(0, 3425, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3425, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_ycoeffs_cpy = __pyx_t_4; __pyx_t_4 = 0;
3426:
+3427: cdef double [:] xcoeffs_view = xcoeffs_cpy
__pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_v_xcoeffs_cpy, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 3427, __pyx_L1_error) __pyx_v_xcoeffs_view = __pyx_t_6; __pyx_t_6.memview = NULL; __pyx_t_6.data = NULL;
+3428: cdef double [:] ycoeffs_view = ycoeffs_cpy
__pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_v_ycoeffs_cpy, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 3428, __pyx_L1_error) __pyx_v_ycoeffs_view = __pyx_t_6; __pyx_t_6.memview = NULL; __pyx_t_6.data = NULL;
3429:
+3430: gen = mus_any.from_ptr(cclm.mus_make_filter(order, &xcoeffs_view[0], &ycoeffs_view[0], NULL))
__pyx_t_7 = 0;
__pyx_t_8 = -1;
if (__pyx_t_7 < 0) {
__pyx_t_7 += __pyx_v_xcoeffs_view.shape[0];
if (unlikely(__pyx_t_7 < 0)) __pyx_t_8 = 0;
} else if (unlikely(__pyx_t_7 >= __pyx_v_xcoeffs_view.shape[0])) __pyx_t_8 = 0;
if (unlikely(__pyx_t_8 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_8);
__PYX_ERR(0, 3430, __pyx_L1_error)
}
__pyx_t_9 = 0;
__pyx_t_8 = -1;
if (__pyx_t_9 < 0) {
__pyx_t_9 += __pyx_v_ycoeffs_view.shape[0];
if (unlikely(__pyx_t_9 < 0)) __pyx_t_8 = 0;
} else if (unlikely(__pyx_t_9 >= __pyx_v_ycoeffs_view.shape[0])) __pyx_t_8 = 0;
if (unlikely(__pyx_t_8 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_8);
__PYX_ERR(0, 3430, __pyx_L1_error)
}
__pyx_t_4 = ((PyObject *)__pyx_vtabptr_8pysndlib_3clm_mus_any->from_ptr(mus_make_filter(__pyx_v_order, (&(*((double *) ( /* dim=0 */ (__pyx_v_xcoeffs_view.data + __pyx_t_7 * __pyx_v_xcoeffs_view.strides[0]) )))), (&(*((double *) ( /* dim=0 */ (__pyx_v_ycoeffs_view.data + __pyx_t_9 * __pyx_v_ycoeffs_view.strides[0]) )))), NULL), NULL)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3430, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_t_4);
__pyx_t_4 = 0;
3431:
+3432: gen.cache_extend([xcoeffs_cpy, ycoeffs_cpy])
__pyx_t_4 = PyList_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3432, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_INCREF(__pyx_v_xcoeffs_cpy); __Pyx_GIVEREF(__pyx_v_xcoeffs_cpy); if (__Pyx_PyList_SET_ITEM(__pyx_t_4, 0, __pyx_v_xcoeffs_cpy)) __PYX_ERR(0, 3432, __pyx_L1_error); __Pyx_INCREF(__pyx_v_ycoeffs_cpy); __Pyx_GIVEREF(__pyx_v_ycoeffs_cpy); if (__Pyx_PyList_SET_ITEM(__pyx_t_4, 1, __pyx_v_ycoeffs_cpy)) __PYX_ERR(0, 3432, __pyx_L1_error); __pyx_t_1 = ((struct __pyx_vtabstruct_8pysndlib_3clm_mus_any *)__pyx_v_gen->__pyx_vtab)->cache_extend(__pyx_v_gen, __pyx_t_4, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3432, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+3433: return gen
__Pyx_XDECREF((PyObject *)__pyx_r); __Pyx_INCREF((PyObject *)__pyx_v_gen); __pyx_r = __pyx_v_gen; goto __pyx_L0;
3434:
+3435: cpdef cython.double filter(mus_any gen, cython.double insig): # todo : conflicts with buitl in function
static PyObject *__pyx_pw_8pysndlib_3clm_343filter(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static double __pyx_f_8pysndlib_3clm_filter(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, double __pyx_v_insig, CYTHON_UNUSED int __pyx_skip_dispatch) {
double __pyx_r;
/* … */
/* function exit code */
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_343filter(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_342filter, "\n next sample from filter.\n \n :param gen: filter gen\n :param insig: input value\n :rtype: float\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_343filter = {"filter", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_343filter, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_342filter};
static PyObject *__pyx_pw_8pysndlib_3clm_343filter(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = 0;
double __pyx_v_insig;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("filter (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gen,&__pyx_n_s_insig,0};
PyObject* values[2] = {0,0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_gen)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3435, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_insig)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3435, __pyx_L3_error)
else {
__Pyx_RaiseArgtupleInvalid("filter", 1, 2, 2, 1); __PYX_ERR(0, 3435, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "filter") < 0)) __PYX_ERR(0, 3435, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 2)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
}
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)values[0]);
__pyx_v_insig = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_insig == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 3435, __pyx_L3_error)
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("filter", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 3435, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.filter", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gen), __pyx_ptype_8pysndlib_3clm_mus_any, 1, "gen", 0))) __PYX_ERR(0, 3435, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_342filter(__pyx_self, __pyx_v_gen, __pyx_v_insig);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_342filter(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, double __pyx_v_insig) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8pysndlib_3clm_filter(__pyx_v_gen, __pyx_v_insig, 0); if (unlikely(__pyx_t_1 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 3435, __pyx_L1_error)
__pyx_t_2 = PyFloat_FromDouble(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3435, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("pysndlib.clm.filter", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_343filter, 0, __pyx_n_s_filter, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__434)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 3435, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_filter, __pyx_t_40) < 0) __PYX_ERR(0, 3435, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
/* … */
__pyx_codeobj__434 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__380, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_filter, 3435, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__434)) __PYX_ERR(0, 3435, __pyx_L1_error)
3436: """
3437: next sample from filter.
3438:
3439: :param gen: filter gen
3440: :param insig: input value
3441: :rtype: float
3442: """
+3443: return cclm.mus_filter(gen._ptr, insig)
__pyx_r = mus_filter(__pyx_v_gen->_ptr, __pyx_v_insig); goto __pyx_L0;
3444:
+3445: cpdef bint is_filter(mus_any gen ):
static PyObject *__pyx_pw_8pysndlib_3clm_345is_filter(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static int __pyx_f_8pysndlib_3clm_is_filter(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, CYTHON_UNUSED int __pyx_skip_dispatch) {
int __pyx_r;
/* … */
/* function exit code */
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_345is_filter(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_344is_filter, "\n returns True if gen is a filter.\n \n :param gen: gen\n :rtype: bool\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_345is_filter = {"is_filter", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_345is_filter, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_344is_filter};
static PyObject *__pyx_pw_8pysndlib_3clm_345is_filter(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("is_filter (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gen,0};
PyObject* values[1] = {0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_gen)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3445, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "is_filter") < 0)) __PYX_ERR(0, 3445, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 1)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
}
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)values[0]);
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("is_filter", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 3445, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.is_filter", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gen), __pyx_ptype_8pysndlib_3clm_mus_any, 1, "gen", 0))) __PYX_ERR(0, 3445, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_344is_filter(__pyx_self, __pyx_v_gen);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_344is_filter(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8pysndlib_3clm_is_filter(__pyx_v_gen, 0); if (unlikely(__pyx_t_1 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3445, __pyx_L1_error)
__pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3445, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("pysndlib.clm.is_filter", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_345is_filter, 0, __pyx_n_s_is_filter, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__435)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 3445, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_is_filter, __pyx_t_40) < 0) __PYX_ERR(0, 3445, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
/* … */
__pyx_codeobj__435 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__56, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_is_filter, 3445, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__435)) __PYX_ERR(0, 3445, __pyx_L1_error)
3446: """
3447: returns True if gen is a filter.
3448:
3449: :param gen: gen
3450: :rtype: bool
3451: """
+3452: return cclm.mus_is_filter(gen._ptr)
__pyx_r = mus_is_filter(__pyx_v_gen->_ptr); goto __pyx_L0;
3453:
3454: # ---------------- fir-filter ---------------- #
+3455: cpdef mus_any make_fir_filter(cython.int order, xcoeffs):
static PyObject *__pyx_pw_8pysndlib_3clm_347make_fir_filter(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_f_8pysndlib_3clm_make_fir_filter(int __pyx_v_order, PyObject *__pyx_v_xcoeffs, CYTHON_UNUSED int __pyx_skip_dispatch) {
__Pyx_memviewslice __pyx_v_xcoeffs_view = { 0, 0, { 0 }, { 0 }, { 0 } };
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = NULL;
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_r = NULL;
__Pyx_INCREF(__pyx_v_xcoeffs);
/* … */
/* function exit code */
__pyx_L1_error:;
__PYX_XCLEAR_MEMVIEW(&__pyx_t_1, 1);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_XDECREF(__pyx_t_5);
__Pyx_XDECREF(__pyx_t_6);
__Pyx_XDECREF(__pyx_t_7);
__Pyx_AddTraceback("pysndlib.clm.make_fir_filter", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__PYX_XCLEAR_MEMVIEW(&__pyx_v_xcoeffs_view, 1);
__Pyx_XDECREF((PyObject *)__pyx_v_gen);
__Pyx_XDECREF(__pyx_v_xcoeffs);
__Pyx_XGIVEREF((PyObject *)__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_347make_fir_filter(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_346make_fir_filter, "\n return a new fir filter, xcoeffs a list/ndarray.\n \n :param order: filter order\n :param xcoeffs: x coeffs\n :return: fir_filter gen\n :rtype: mus_any\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_347make_fir_filter = {"make_fir_filter", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_347make_fir_filter, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_346make_fir_filter};
static PyObject *__pyx_pw_8pysndlib_3clm_347make_fir_filter(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
int __pyx_v_order;
PyObject *__pyx_v_xcoeffs = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("make_fir_filter (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_order,&__pyx_n_s_xcoeffs,0};
PyObject* values[2] = {0,0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_order)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3455, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_xcoeffs)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3455, __pyx_L3_error)
else {
__Pyx_RaiseArgtupleInvalid("make_fir_filter", 1, 2, 2, 1); __PYX_ERR(0, 3455, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "make_fir_filter") < 0)) __PYX_ERR(0, 3455, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 2)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
}
__pyx_v_order = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_order == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3455, __pyx_L3_error)
__pyx_v_xcoeffs = values[1];
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("make_fir_filter", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 3455, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.make_fir_filter", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_8pysndlib_3clm_346make_fir_filter(__pyx_self, __pyx_v_order, __pyx_v_xcoeffs);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_346make_fir_filter(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_order, PyObject *__pyx_v_xcoeffs) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = ((PyObject *)__pyx_f_8pysndlib_3clm_make_fir_filter(__pyx_v_order, __pyx_v_xcoeffs, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3455, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("pysndlib.clm.make_fir_filter", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_tuple__436 = PyTuple_Pack(2, __pyx_n_s_order, __pyx_n_s_xcoeffs); if (unlikely(!__pyx_tuple__436)) __PYX_ERR(0, 3455, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__436);
__Pyx_GIVEREF(__pyx_tuple__436);
/* … */
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_347make_fir_filter, 0, __pyx_n_s_make_fir_filter, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__437)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 3455, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_make_fir_filter, __pyx_t_40) < 0) __PYX_ERR(0, 3455, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
__pyx_codeobj__437 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__436, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_make_fir_filter, 3455, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__437)) __PYX_ERR(0, 3455, __pyx_L1_error)
3456: """
3457: return a new fir filter, xcoeffs a list/ndarray.
3458:
3459: :param order: filter order
3460: :param xcoeffs: x coeffs
3461: :return: fir_filter gen
3462: :rtype: mus_any
3463: """
+3464: cdef double [:] xcoeffs_view = None
__pyx_t_1 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(Py_None, PyBUF_WRITABLE); if (unlikely(!__pyx_t_1.memview)) __PYX_ERR(0, 3464, __pyx_L1_error) __pyx_v_xcoeffs_view = __pyx_t_1; __pyx_t_1.memview = NULL; __pyx_t_1.data = NULL;
3465:
+3466: if isinstance(xcoeffs, list):
__pyx_t_2 = PyList_Check(__pyx_v_xcoeffs);
if (__pyx_t_2) {
/* … */
}
+3467: xcoeffs = np.array(xcoeffs, dtype=np.double)
__Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3467, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_array); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3467, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3467, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_v_xcoeffs); __Pyx_GIVEREF(__pyx_v_xcoeffs); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_xcoeffs)) __PYX_ERR(0, 3467, __pyx_L1_error); __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3467, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3467, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_double); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3467, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_dtype, __pyx_t_7) < 0) __PYX_ERR(0, 3467, __pyx_L1_error) __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3467, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF_SET(__pyx_v_xcoeffs, __pyx_t_7); __pyx_t_7 = 0;
3468:
+3469: xcoeffs_view = xcoeffs
__pyx_t_1 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_v_xcoeffs, PyBUF_WRITABLE); if (unlikely(!__pyx_t_1.memview)) __PYX_ERR(0, 3469, __pyx_L1_error) __PYX_XCLEAR_MEMVIEW(&__pyx_v_xcoeffs_view, 1); __pyx_v_xcoeffs_view = __pyx_t_1; __pyx_t_1.memview = NULL; __pyx_t_1.data = NULL;
3470:
+3471: gen = mus_any.from_ptr(cclm.mus_make_fir_filter(order, &xcoeffs_view[0], NULL))
__pyx_t_8 = 0;
__pyx_t_9 = -1;
if (__pyx_t_8 < 0) {
__pyx_t_8 += __pyx_v_xcoeffs_view.shape[0];
if (unlikely(__pyx_t_8 < 0)) __pyx_t_9 = 0;
} else if (unlikely(__pyx_t_8 >= __pyx_v_xcoeffs_view.shape[0])) __pyx_t_9 = 0;
if (unlikely(__pyx_t_9 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_9);
__PYX_ERR(0, 3471, __pyx_L1_error)
}
__pyx_t_7 = ((PyObject *)__pyx_vtabptr_8pysndlib_3clm_mus_any->from_ptr(mus_make_fir_filter(__pyx_v_order, (&(*((double *) ( /* dim=0 */ (__pyx_v_xcoeffs_view.data + __pyx_t_8 * __pyx_v_xcoeffs_view.strides[0]) )))), NULL), NULL)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3471, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_7);
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_t_7);
__pyx_t_7 = 0;
+3472: gen.cache_append(xcoeffs)
__pyx_t_7 = ((struct __pyx_vtabstruct_8pysndlib_3clm_mus_any *)__pyx_v_gen->__pyx_vtab)->cache_append(__pyx_v_gen, __pyx_v_xcoeffs, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3472, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
3473:
+3474: return gen
__Pyx_XDECREF((PyObject *)__pyx_r); __Pyx_INCREF((PyObject *)__pyx_v_gen); __pyx_r = __pyx_v_gen; goto __pyx_L0;
3475:
+3476: cpdef cython.double fir_filter(mus_any gen, cython.double insig):
static PyObject *__pyx_pw_8pysndlib_3clm_349fir_filter(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static double __pyx_f_8pysndlib_3clm_fir_filter(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, double __pyx_v_insig, CYTHON_UNUSED int __pyx_skip_dispatch) {
double __pyx_r;
/* … */
/* function exit code */
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_349fir_filter(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_348fir_filter, "\n next sample from fir filter.\n \n :param gen: fir_filter gen\n :param insig: input value\n :rtype: float\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_349fir_filter = {"fir_filter", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_349fir_filter, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_348fir_filter};
static PyObject *__pyx_pw_8pysndlib_3clm_349fir_filter(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = 0;
double __pyx_v_insig;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("fir_filter (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gen,&__pyx_n_s_insig,0};
PyObject* values[2] = {0,0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_gen)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3476, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_insig)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3476, __pyx_L3_error)
else {
__Pyx_RaiseArgtupleInvalid("fir_filter", 1, 2, 2, 1); __PYX_ERR(0, 3476, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "fir_filter") < 0)) __PYX_ERR(0, 3476, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 2)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
}
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)values[0]);
__pyx_v_insig = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_insig == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 3476, __pyx_L3_error)
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("fir_filter", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 3476, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.fir_filter", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gen), __pyx_ptype_8pysndlib_3clm_mus_any, 1, "gen", 0))) __PYX_ERR(0, 3476, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_348fir_filter(__pyx_self, __pyx_v_gen, __pyx_v_insig);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_348fir_filter(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, double __pyx_v_insig) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8pysndlib_3clm_fir_filter(__pyx_v_gen, __pyx_v_insig, 0); if (unlikely(__pyx_t_1 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 3476, __pyx_L1_error)
__pyx_t_2 = PyFloat_FromDouble(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3476, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("pysndlib.clm.fir_filter", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_349fir_filter, 0, __pyx_n_s_fir_filter, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__438)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 3476, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_fir_filter, __pyx_t_40) < 0) __PYX_ERR(0, 3476, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
/* … */
__pyx_codeobj__438 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__380, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_fir_filter, 3476, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__438)) __PYX_ERR(0, 3476, __pyx_L1_error)
3477: """
3478: next sample from fir filter.
3479:
3480: :param gen: fir_filter gen
3481: :param insig: input value
3482: :rtype: float
3483: """
+3484: return cclm.mus_fir_filter(gen._ptr, insig)
__pyx_r = mus_fir_filter(__pyx_v_gen->_ptr, __pyx_v_insig); goto __pyx_L0;
3485:
+3486: cpdef bint is_fir_filter(mus_any gen):
static PyObject *__pyx_pw_8pysndlib_3clm_351is_fir_filter(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static int __pyx_f_8pysndlib_3clm_is_fir_filter(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, CYTHON_UNUSED int __pyx_skip_dispatch) {
int __pyx_r;
/* … */
/* function exit code */
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_351is_fir_filter(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_350is_fir_filter, "\n returns True if gen is a fir_filter.\n \n :param gen: gen\n :rtype: bool\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_351is_fir_filter = {"is_fir_filter", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_351is_fir_filter, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_350is_fir_filter};
static PyObject *__pyx_pw_8pysndlib_3clm_351is_fir_filter(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("is_fir_filter (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gen,0};
PyObject* values[1] = {0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_gen)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3486, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "is_fir_filter") < 0)) __PYX_ERR(0, 3486, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 1)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
}
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)values[0]);
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("is_fir_filter", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 3486, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.is_fir_filter", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gen), __pyx_ptype_8pysndlib_3clm_mus_any, 1, "gen", 0))) __PYX_ERR(0, 3486, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_350is_fir_filter(__pyx_self, __pyx_v_gen);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_350is_fir_filter(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8pysndlib_3clm_is_fir_filter(__pyx_v_gen, 0); if (unlikely(__pyx_t_1 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3486, __pyx_L1_error)
__pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3486, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("pysndlib.clm.is_fir_filter", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_351is_fir_filter, 0, __pyx_n_s_is_fir_filter, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__439)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 3486, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_is_fir_filter, __pyx_t_40) < 0) __PYX_ERR(0, 3486, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
/* … */
__pyx_codeobj__439 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__56, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_is_fir_filter, 3486, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__439)) __PYX_ERR(0, 3486, __pyx_L1_error)
3487: """
3488: returns True if gen is a fir_filter.
3489:
3490: :param gen: gen
3491: :rtype: bool
3492: """
+3493: return cclm.mus_is_fir_filter(gen._ptr)
__pyx_r = mus_is_fir_filter(__pyx_v_gen->_ptr); goto __pyx_L0;
3494:
3495:
3496: # ---------------- iir-filter ---------------- #
+3497: cpdef mus_any make_iir_filter(cython.int order, ycoeffs):
static PyObject *__pyx_pw_8pysndlib_3clm_353make_iir_filter(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_f_8pysndlib_3clm_make_iir_filter(int __pyx_v_order, PyObject *__pyx_v_ycoeffs, CYTHON_UNUSED int __pyx_skip_dispatch) {
__Pyx_memviewslice __pyx_v_ycoeffs_view = { 0, 0, { 0 }, { 0 }, { 0 } };
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = NULL;
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_r = NULL;
__Pyx_INCREF(__pyx_v_ycoeffs);
/* … */
/* function exit code */
__pyx_L1_error:;
__PYX_XCLEAR_MEMVIEW(&__pyx_t_1, 1);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_XDECREF(__pyx_t_5);
__Pyx_XDECREF(__pyx_t_6);
__Pyx_XDECREF(__pyx_t_7);
__Pyx_AddTraceback("pysndlib.clm.make_iir_filter", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__PYX_XCLEAR_MEMVIEW(&__pyx_v_ycoeffs_view, 1);
__Pyx_XDECREF((PyObject *)__pyx_v_gen);
__Pyx_XDECREF(__pyx_v_ycoeffs);
__Pyx_XGIVEREF((PyObject *)__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_353make_iir_filter(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_352make_iir_filter, "\n return a new iir filter, ycoeffs a list/ndarray.\n \n :param order: filter order\n :param ycoeffs: y coeffs\n :return: iir_filter gen\n :rtype: mus_any\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_353make_iir_filter = {"make_iir_filter", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_353make_iir_filter, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_352make_iir_filter};
static PyObject *__pyx_pw_8pysndlib_3clm_353make_iir_filter(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
int __pyx_v_order;
PyObject *__pyx_v_ycoeffs = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("make_iir_filter (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_order,&__pyx_n_s_ycoeffs,0};
PyObject* values[2] = {0,0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_order)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3497, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_ycoeffs)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3497, __pyx_L3_error)
else {
__Pyx_RaiseArgtupleInvalid("make_iir_filter", 1, 2, 2, 1); __PYX_ERR(0, 3497, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "make_iir_filter") < 0)) __PYX_ERR(0, 3497, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 2)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
}
__pyx_v_order = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_order == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3497, __pyx_L3_error)
__pyx_v_ycoeffs = values[1];
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("make_iir_filter", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 3497, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.make_iir_filter", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_8pysndlib_3clm_352make_iir_filter(__pyx_self, __pyx_v_order, __pyx_v_ycoeffs);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_352make_iir_filter(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_order, PyObject *__pyx_v_ycoeffs) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = ((PyObject *)__pyx_f_8pysndlib_3clm_make_iir_filter(__pyx_v_order, __pyx_v_ycoeffs, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3497, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("pysndlib.clm.make_iir_filter", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_tuple__440 = PyTuple_Pack(2, __pyx_n_s_order, __pyx_n_s_ycoeffs); if (unlikely(!__pyx_tuple__440)) __PYX_ERR(0, 3497, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__440);
__Pyx_GIVEREF(__pyx_tuple__440);
/* … */
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_353make_iir_filter, 0, __pyx_n_s_make_iir_filter, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__441)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 3497, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_make_iir_filter, __pyx_t_40) < 0) __PYX_ERR(0, 3497, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
__pyx_codeobj__441 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__440, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_make_iir_filter, 3497, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__441)) __PYX_ERR(0, 3497, __pyx_L1_error)
3498: """
3499: return a new iir filter, ycoeffs a list/ndarray.
3500:
3501: :param order: filter order
3502: :param ycoeffs: y coeffs
3503: :return: iir_filter gen
3504: :rtype: mus_any
3505: """
+3506: cdef double [:] ycoeffs_view = None
__pyx_t_1 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(Py_None, PyBUF_WRITABLE); if (unlikely(!__pyx_t_1.memview)) __PYX_ERR(0, 3506, __pyx_L1_error) __pyx_v_ycoeffs_view = __pyx_t_1; __pyx_t_1.memview = NULL; __pyx_t_1.data = NULL;
3507:
+3508: if isinstance(ycoeffs, list):
__pyx_t_2 = PyList_Check(__pyx_v_ycoeffs);
if (__pyx_t_2) {
/* … */
}
+3509: ycoeffs = np.array(ycoeffs, dtype=np.double)
__Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3509, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_array); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3509, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3509, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_v_ycoeffs); __Pyx_GIVEREF(__pyx_v_ycoeffs); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_ycoeffs)) __PYX_ERR(0, 3509, __pyx_L1_error); __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3509, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3509, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_double); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3509, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_dtype, __pyx_t_7) < 0) __PYX_ERR(0, 3509, __pyx_L1_error) __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3509, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF_SET(__pyx_v_ycoeffs, __pyx_t_7); __pyx_t_7 = 0;
3510:
+3511: ycoeffs_view = ycoeffs
__pyx_t_1 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_v_ycoeffs, PyBUF_WRITABLE); if (unlikely(!__pyx_t_1.memview)) __PYX_ERR(0, 3511, __pyx_L1_error) __PYX_XCLEAR_MEMVIEW(&__pyx_v_ycoeffs_view, 1); __pyx_v_ycoeffs_view = __pyx_t_1; __pyx_t_1.memview = NULL; __pyx_t_1.data = NULL;
3512:
3513:
+3514: gen = mus_any.from_ptr(cclm.mus_make_iir_filter(order, &ycoeffs_view[0], NULL))
__pyx_t_8 = 0;
__pyx_t_9 = -1;
if (__pyx_t_8 < 0) {
__pyx_t_8 += __pyx_v_ycoeffs_view.shape[0];
if (unlikely(__pyx_t_8 < 0)) __pyx_t_9 = 0;
} else if (unlikely(__pyx_t_8 >= __pyx_v_ycoeffs_view.shape[0])) __pyx_t_9 = 0;
if (unlikely(__pyx_t_9 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_9);
__PYX_ERR(0, 3514, __pyx_L1_error)
}
__pyx_t_7 = ((PyObject *)__pyx_vtabptr_8pysndlib_3clm_mus_any->from_ptr(mus_make_iir_filter(__pyx_v_order, (&(*((double *) ( /* dim=0 */ (__pyx_v_ycoeffs_view.data + __pyx_t_8 * __pyx_v_ycoeffs_view.strides[0]) )))), NULL), NULL)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3514, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_7);
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_t_7);
__pyx_t_7 = 0;
+3515: gen.cache_append(ycoeffs)
__pyx_t_7 = ((struct __pyx_vtabstruct_8pysndlib_3clm_mus_any *)__pyx_v_gen->__pyx_vtab)->cache_append(__pyx_v_gen, __pyx_v_ycoeffs, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3515, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+3516: return gen
__Pyx_XDECREF((PyObject *)__pyx_r); __Pyx_INCREF((PyObject *)__pyx_v_gen); __pyx_r = __pyx_v_gen; goto __pyx_L0;
3517:
+3518: cpdef cython.double iir_filter(mus_any gen, cython.double insig ):
static PyObject *__pyx_pw_8pysndlib_3clm_355iir_filter(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static double __pyx_f_8pysndlib_3clm_iir_filter(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, double __pyx_v_insig, CYTHON_UNUSED int __pyx_skip_dispatch) {
double __pyx_r;
/* … */
/* function exit code */
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_355iir_filter(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_354iir_filter, "\n next sample from iir filter.\n \n :param gen: iir_filter gen\n :param insig: input value\n :rtype: float\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_355iir_filter = {"iir_filter", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_355iir_filter, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_354iir_filter};
static PyObject *__pyx_pw_8pysndlib_3clm_355iir_filter(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = 0;
double __pyx_v_insig;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("iir_filter (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gen,&__pyx_n_s_insig,0};
PyObject* values[2] = {0,0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_gen)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3518, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_insig)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3518, __pyx_L3_error)
else {
__Pyx_RaiseArgtupleInvalid("iir_filter", 1, 2, 2, 1); __PYX_ERR(0, 3518, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "iir_filter") < 0)) __PYX_ERR(0, 3518, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 2)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
}
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)values[0]);
__pyx_v_insig = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_insig == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 3518, __pyx_L3_error)
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("iir_filter", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 3518, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.iir_filter", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gen), __pyx_ptype_8pysndlib_3clm_mus_any, 1, "gen", 0))) __PYX_ERR(0, 3518, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_354iir_filter(__pyx_self, __pyx_v_gen, __pyx_v_insig);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_354iir_filter(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, double __pyx_v_insig) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8pysndlib_3clm_iir_filter(__pyx_v_gen, __pyx_v_insig, 0); if (unlikely(__pyx_t_1 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 3518, __pyx_L1_error)
__pyx_t_2 = PyFloat_FromDouble(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3518, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("pysndlib.clm.iir_filter", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_355iir_filter, 0, __pyx_n_s_iir_filter, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__442)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 3518, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_iir_filter, __pyx_t_40) < 0) __PYX_ERR(0, 3518, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
/* … */
__pyx_codeobj__442 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__380, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_iir_filter, 3518, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__442)) __PYX_ERR(0, 3518, __pyx_L1_error)
3519: """
3520: next sample from iir filter.
3521:
3522: :param gen: iir_filter gen
3523: :param insig: input value
3524: :rtype: float
3525: """
+3526: return cclm.mus_iir_filter(gen._ptr, insig)
__pyx_r = mus_iir_filter(__pyx_v_gen->_ptr, __pyx_v_insig); goto __pyx_L0;
3527:
+3528: cpdef bint is_iir_filter(mus_any gen):
static PyObject *__pyx_pw_8pysndlib_3clm_357is_iir_filter(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static int __pyx_f_8pysndlib_3clm_is_iir_filter(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, CYTHON_UNUSED int __pyx_skip_dispatch) {
int __pyx_r;
/* … */
/* function exit code */
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_357is_iir_filter(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_356is_iir_filter, "\n returns True if gen is a iir_filter\n :param gen: gen\n :rtype: bool\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_357is_iir_filter = {"is_iir_filter", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_357is_iir_filter, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_356is_iir_filter};
static PyObject *__pyx_pw_8pysndlib_3clm_357is_iir_filter(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("is_iir_filter (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gen,0};
PyObject* values[1] = {0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_gen)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3528, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "is_iir_filter") < 0)) __PYX_ERR(0, 3528, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 1)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
}
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)values[0]);
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("is_iir_filter", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 3528, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.is_iir_filter", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gen), __pyx_ptype_8pysndlib_3clm_mus_any, 1, "gen", 0))) __PYX_ERR(0, 3528, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_356is_iir_filter(__pyx_self, __pyx_v_gen);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_356is_iir_filter(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8pysndlib_3clm_is_iir_filter(__pyx_v_gen, 0); if (unlikely(__pyx_t_1 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3528, __pyx_L1_error)
__pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3528, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("pysndlib.clm.is_iir_filter", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_357is_iir_filter, 0, __pyx_n_s_is_iir_filter, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__443)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 3528, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_is_iir_filter, __pyx_t_40) < 0) __PYX_ERR(0, 3528, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
/* … */
__pyx_codeobj__443 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__56, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_is_iir_filter, 3528, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__443)) __PYX_ERR(0, 3528, __pyx_L1_error)
3529: """
3530: returns True if gen is a iir_filter
3531: :param gen: gen
3532: :rtype: bool
3533: """
+3534: return cclm.mus_is_iir_filter(gen._ptr)
__pyx_r = mus_is_iir_filter(__pyx_v_gen->_ptr); goto __pyx_L0;
3535:
+3536: cpdef np.ndarray make_fir_coeffs(cython.int order, envelope):
static PyObject *__pyx_pw_8pysndlib_3clm_359make_fir_coeffs(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyArrayObject *__pyx_f_8pysndlib_3clm_make_fir_coeffs(int __pyx_v_order, PyObject *__pyx_v_envelope, CYTHON_UNUSED int __pyx_skip_dispatch) {
__Pyx_memviewslice __pyx_v_envelope_view = { 0, 0, { 0 }, { 0 }, { 0 } };
PyObject *__pyx_v_coeffs = NULL;
__Pyx_memviewslice __pyx_v_coeffs_view = { 0, 0, { 0 }, { 0 }, { 0 } };
PyArrayObject *__pyx_r = NULL;
__Pyx_INCREF(__pyx_v_envelope);
/* … */
/* function exit code */
__pyx_L1_error:;
__PYX_XCLEAR_MEMVIEW(&__pyx_t_1, 1);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_XDECREF(__pyx_t_5);
__Pyx_XDECREF(__pyx_t_6);
__Pyx_XDECREF(__pyx_t_7);
__Pyx_AddTraceback("pysndlib.clm.make_fir_coeffs", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__PYX_XCLEAR_MEMVIEW(&__pyx_v_envelope_view, 1);
__Pyx_XDECREF(__pyx_v_coeffs);
__PYX_XCLEAR_MEMVIEW(&__pyx_v_coeffs_view, 1);
__Pyx_XDECREF(__pyx_v_envelope);
__Pyx_XGIVEREF((PyObject *)__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_359make_fir_coeffs(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_358make_fir_coeffs, "\n translates a frequency response envelope (actually, evenly spaced points \\in a float-vector) into\n the corresponding FIR filter coefficients. The order of the filter determines how close you get to the\n envelope.\n \n :param order: order of the filter\n :param envelope: response envelope\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_359make_fir_coeffs = {"make_fir_coeffs", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_359make_fir_coeffs, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_358make_fir_coeffs};
static PyObject *__pyx_pw_8pysndlib_3clm_359make_fir_coeffs(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
int __pyx_v_order;
PyObject *__pyx_v_envelope = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("make_fir_coeffs (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_order,&__pyx_n_s_envelope,0};
PyObject* values[2] = {0,0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_order)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3536, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_envelope)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3536, __pyx_L3_error)
else {
__Pyx_RaiseArgtupleInvalid("make_fir_coeffs", 1, 2, 2, 1); __PYX_ERR(0, 3536, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "make_fir_coeffs") < 0)) __PYX_ERR(0, 3536, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 2)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
}
__pyx_v_order = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_order == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3536, __pyx_L3_error)
__pyx_v_envelope = values[1];
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("make_fir_coeffs", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 3536, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.make_fir_coeffs", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_8pysndlib_3clm_358make_fir_coeffs(__pyx_self, __pyx_v_order, __pyx_v_envelope);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_358make_fir_coeffs(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_order, PyObject *__pyx_v_envelope) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = ((PyObject *)__pyx_f_8pysndlib_3clm_make_fir_coeffs(__pyx_v_order, __pyx_v_envelope, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3536, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("pysndlib.clm.make_fir_coeffs", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_tuple__444 = PyTuple_Pack(2, __pyx_n_s_order, __pyx_n_s_envelope); if (unlikely(!__pyx_tuple__444)) __PYX_ERR(0, 3536, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__444);
__Pyx_GIVEREF(__pyx_tuple__444);
/* … */
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_359make_fir_coeffs, 0, __pyx_n_s_make_fir_coeffs, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__445)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 3536, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_make_fir_coeffs, __pyx_t_40) < 0) __PYX_ERR(0, 3536, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
__pyx_codeobj__445 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__444, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_make_fir_coeffs, 3536, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__445)) __PYX_ERR(0, 3536, __pyx_L1_error)
3537: """
3538: translates a frequency response envelope (actually, evenly spaced points \in a float-vector) into
3539: the corresponding FIR filter coefficients. The order of the filter determines how close you get to the
3540: envelope.
3541:
3542: :param order: order of the filter
3543: :param envelope: response envelope
3544: """
+3545: cdef double [:] envelope_view = None
__pyx_t_1 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(Py_None, PyBUF_WRITABLE); if (unlikely(!__pyx_t_1.memview)) __PYX_ERR(0, 3545, __pyx_L1_error) __pyx_v_envelope_view = __pyx_t_1; __pyx_t_1.memview = NULL; __pyx_t_1.data = NULL;
3546:
+3547: if isinstance(envelope, list):
__pyx_t_2 = PyList_Check(__pyx_v_envelope);
if (__pyx_t_2) {
/* … */
}
+3548: envelope = np.ndarray(envelope)
__pyx_t_3 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_5numpy_ndarray), __pyx_v_envelope); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3548, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF_SET(__pyx_v_envelope, __pyx_t_3); __pyx_t_3 = 0;
3549:
+3550: check_ndim(envelope)
__pyx_t_3 = __pyx_f_8pysndlib_3clm_check_ndim(__pyx_v_envelope, 0, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3550, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3551:
+3552: envelope_view = envelope
__pyx_t_1 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_v_envelope, PyBUF_WRITABLE); if (unlikely(!__pyx_t_1.memview)) __PYX_ERR(0, 3552, __pyx_L1_error) __PYX_XCLEAR_MEMVIEW(&__pyx_v_envelope_view, 1); __pyx_v_envelope_view = __pyx_t_1; __pyx_t_1.memview = NULL; __pyx_t_1.data = NULL;
3553:
+3554: coeffs = np.zeros(order+1, dtype=np.double)
__Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3554, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3554, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = __Pyx_PyInt_From_long((__pyx_v_order + 1)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3554, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3554, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_GIVEREF(__pyx_t_3); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3)) __PYX_ERR(0, 3554, __pyx_L1_error); __pyx_t_3 = 0; __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3554, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3554, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_double); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3554, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_dtype, __pyx_t_7) < 0) __PYX_ERR(0, 3554, __pyx_L1_error) __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_5, __pyx_t_3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3554, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_coeffs = __pyx_t_7; __pyx_t_7 = 0;
3555:
+3556: cdef double [:] coeffs_view = coeffs
__pyx_t_1 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_v_coeffs, PyBUF_WRITABLE); if (unlikely(!__pyx_t_1.memview)) __PYX_ERR(0, 3556, __pyx_L1_error) __pyx_v_coeffs_view = __pyx_t_1; __pyx_t_1.memview = NULL; __pyx_t_1.data = NULL;
3557:
+3558: cclm.mus_make_fir_coeffs(order, &envelope_view[0], &coeffs_view[0])
__pyx_t_8 = 0;
__pyx_t_9 = -1;
if (__pyx_t_8 < 0) {
__pyx_t_8 += __pyx_v_envelope_view.shape[0];
if (unlikely(__pyx_t_8 < 0)) __pyx_t_9 = 0;
} else if (unlikely(__pyx_t_8 >= __pyx_v_envelope_view.shape[0])) __pyx_t_9 = 0;
if (unlikely(__pyx_t_9 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_9);
__PYX_ERR(0, 3558, __pyx_L1_error)
}
__pyx_t_10 = 0;
__pyx_t_9 = -1;
if (__pyx_t_10 < 0) {
__pyx_t_10 += __pyx_v_coeffs_view.shape[0];
if (unlikely(__pyx_t_10 < 0)) __pyx_t_9 = 0;
} else if (unlikely(__pyx_t_10 >= __pyx_v_coeffs_view.shape[0])) __pyx_t_9 = 0;
if (unlikely(__pyx_t_9 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_9);
__PYX_ERR(0, 3558, __pyx_L1_error)
}
(void)(mus_make_fir_coeffs(__pyx_v_order, (&(*((double *) ( /* dim=0 */ (__pyx_v_envelope_view.data + __pyx_t_8 * __pyx_v_envelope_view.strides[0]) )))), (&(*((double *) ( /* dim=0 */ (__pyx_v_coeffs_view.data + __pyx_t_10 * __pyx_v_coeffs_view.strides[0]) ))))));
+3559: return coeffs
__Pyx_XDECREF((PyObject *)__pyx_r); if (!(likely(((__pyx_v_coeffs) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_coeffs, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 3559, __pyx_L1_error) __Pyx_INCREF(__pyx_v_coeffs); __pyx_r = ((PyArrayObject *)__pyx_v_coeffs); goto __pyx_L0;
3560:
3561:
3562: # ---------------- delay ---------------- #
+3563: cpdef mus_any make_delay(cython.long size, initial_contents=None, initial_element=None, max_size=None, Interp interp_type=Interp.NONE):
static PyObject *__pyx_pw_8pysndlib_3clm_361make_delay(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_f_8pysndlib_3clm_make_delay(long __pyx_v_size, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_8pysndlib_3clm_make_delay *__pyx_optional_args) {
PyObject *__pyx_v_initial_contents = ((PyObject *)Py_None);
PyObject *__pyx_v_initial_element = ((PyObject *)Py_None);
PyObject *__pyx_v_max_size = ((PyObject *)Py_None);
enum __pyx_t_8pysndlib_3clm_Interp __pyx_v_interp_type = __pyx_k__43;
__Pyx_memviewslice __pyx_v_initial_contents_view = { 0, 0, { 0 }, { 0 }, { 0 } };
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = NULL;
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_r = NULL;
if (__pyx_optional_args) {
if (__pyx_optional_args->__pyx_n > 0) {
__pyx_v_initial_contents = __pyx_optional_args->initial_contents;
if (__pyx_optional_args->__pyx_n > 1) {
__pyx_v_initial_element = __pyx_optional_args->initial_element;
if (__pyx_optional_args->__pyx_n > 2) {
__pyx_v_max_size = __pyx_optional_args->max_size;
if (__pyx_optional_args->__pyx_n > 3) {
__pyx_v_interp_type = __pyx_optional_args->interp_type;
}
}
}
}
}
__Pyx_INCREF(__pyx_v_initial_contents);
__Pyx_INCREF(__pyx_v_max_size);
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__PYX_XCLEAR_MEMVIEW(&__pyx_t_4, 1);
__Pyx_XDECREF(__pyx_t_7);
__Pyx_XDECREF(__pyx_t_9);
__Pyx_XDECREF(__pyx_t_10);
__Pyx_AddTraceback("pysndlib.clm.make_delay", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__PYX_XCLEAR_MEMVIEW(&__pyx_v_initial_contents_view, 1);
__Pyx_XDECREF((PyObject *)__pyx_v_gen);
__Pyx_XDECREF(__pyx_v_initial_contents);
__Pyx_XDECREF(__pyx_v_max_size);
__Pyx_XGIVEREF((PyObject *)__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_361make_delay(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_360make_delay, "\n return a new delay line of size elements. if the delay length will be changing at run-time,\n max-size sets its maximum length.\n \n :param size: delay length \\in samples\n :param initial_contents: delay line's initial values\n :param initial_element: delay line's initial element\n :param max_size: maximum delay size \\in case the delay changes\n :param type: interpolation type\n :return: delay gen\n :rtype: mus_any\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_361make_delay = {"make_delay", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_361make_delay, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_360make_delay};
static PyObject *__pyx_pw_8pysndlib_3clm_361make_delay(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
long __pyx_v_size;
PyObject *__pyx_v_initial_contents = 0;
PyObject *__pyx_v_initial_element = 0;
PyObject *__pyx_v_max_size = 0;
enum __pyx_t_8pysndlib_3clm_Interp __pyx_v_interp_type;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("make_delay (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_size,&__pyx_n_s_initial_contents,&__pyx_n_s_initial_element,&__pyx_n_s_max_size,&__pyx_n_s_interp_type,0};
PyObject* values[5] = {0,0,0,0,0};
values[1] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
values[2] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
values[3] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4);
CYTHON_FALLTHROUGH;
case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
CYTHON_FALLTHROUGH;
case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_size)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3563, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_initial_contents);
if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3563, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 2:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_initial_element);
if (value) { values[2] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3563, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 3:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_max_size);
if (value) { values[3] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3563, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 4:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_interp_type);
if (value) { values[4] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3563, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "make_delay") < 0)) __PYX_ERR(0, 3563, __pyx_L3_error)
}
} else {
switch (__pyx_nargs) {
case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4);
CYTHON_FALLTHROUGH;
case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
CYTHON_FALLTHROUGH;
case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
break;
default: goto __pyx_L5_argtuple_error;
}
}
__pyx_v_size = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_size == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 3563, __pyx_L3_error)
__pyx_v_initial_contents = values[1];
__pyx_v_initial_element = values[2];
__pyx_v_max_size = values[3];
if (values[4]) {
__pyx_v_interp_type = ((enum __pyx_t_8pysndlib_3clm_Interp)__Pyx_PyInt_As_enum____pyx_t_8pysndlib_3clm_Interp(values[4])); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3563, __pyx_L3_error)
} else {
__pyx_v_interp_type = __pyx_k__43;
}
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("make_delay", 0, 1, 5, __pyx_nargs); __PYX_ERR(0, 3563, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.make_delay", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_8pysndlib_3clm_360make_delay(__pyx_self, __pyx_v_size, __pyx_v_initial_contents, __pyx_v_initial_element, __pyx_v_max_size, __pyx_v_interp_type);
/* function exit code */
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_360make_delay(CYTHON_UNUSED PyObject *__pyx_self, long __pyx_v_size, PyObject *__pyx_v_initial_contents, PyObject *__pyx_v_initial_element, PyObject *__pyx_v_max_size, enum __pyx_t_8pysndlib_3clm_Interp __pyx_v_interp_type) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_2.__pyx_n = 4;
__pyx_t_2.initial_contents = __pyx_v_initial_contents;
__pyx_t_2.initial_element = __pyx_v_initial_element;
__pyx_t_2.max_size = __pyx_v_max_size;
__pyx_t_2.interp_type = __pyx_v_interp_type;
__pyx_t_1 = ((PyObject *)__pyx_f_8pysndlib_3clm_make_delay(__pyx_v_size, 0, &__pyx_t_2)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3563, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("pysndlib.clm.make_delay", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_k__43 = __pyx_e_8pysndlib_3clm_NONE;
/* … */
__pyx_tuple__446 = PyTuple_Pack(5, __pyx_n_s_size, __pyx_n_s_initial_contents, __pyx_n_s_initial_element, __pyx_n_s_max_size, __pyx_n_s_interp_type); if (unlikely(!__pyx_tuple__446)) __PYX_ERR(0, 3563, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__446);
__Pyx_GIVEREF(__pyx_tuple__446);
__pyx_t_40 = __Pyx_Enum_Interp_to_py(__pyx_e_8pysndlib_3clm_NONE); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 3563, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
__pyx_t_43 = PyTuple_New(4); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 3563, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
__Pyx_INCREF(Py_None);
__Pyx_GIVEREF(Py_None);
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_43, 0, Py_None)) __PYX_ERR(0, 3563, __pyx_L1_error);
__Pyx_INCREF(Py_None);
__Pyx_GIVEREF(Py_None);
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_43, 1, Py_None)) __PYX_ERR(0, 3563, __pyx_L1_error);
__Pyx_INCREF(Py_None);
__Pyx_GIVEREF(Py_None);
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_43, 2, Py_None)) __PYX_ERR(0, 3563, __pyx_L1_error);
__Pyx_GIVEREF(__pyx_t_40);
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_43, 3, __pyx_t_40)) __PYX_ERR(0, 3563, __pyx_L1_error);
__pyx_t_40 = 0;
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_361make_delay, 0, __pyx_n_s_make_delay, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__447)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 3563, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
__Pyx_CyFunction_SetDefaultsTuple(__pyx_t_40, __pyx_t_43);
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
if (PyDict_SetItem(__pyx_d, __pyx_n_s_make_delay, __pyx_t_40) < 0) __PYX_ERR(0, 3563, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
__pyx_codeobj__447 = (PyObject*)__Pyx_PyCode_New(5, 0, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__446, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_make_delay, 3563, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__447)) __PYX_ERR(0, 3563, __pyx_L1_error)
/* … */
struct __pyx_opt_args_8pysndlib_3clm_make_delay {
int __pyx_n;
PyObject *initial_contents;
PyObject *initial_element;
PyObject *max_size;
enum __pyx_t_8pysndlib_3clm_Interp interp_type;
};
3564: """
3565: return a new delay line of size elements. if the delay length will be changing at run-time,
3566: max-size sets its maximum length.
3567:
3568: :param size: delay length \in samples
3569: :param initial_contents: delay line's initial values
3570: :param initial_element: delay line's initial element
3571: :param max_size: maximum delay size \in case the delay changes
3572: :param type: interpolation type
3573: :return: delay gen
3574: :rtype: mus_any
3575: """
3576:
+3577: check_range('size', size, 0, None)
__pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3577, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_3.__pyx_n = 2; __pyx_t_3.low = __pyx_int_0; __pyx_t_3.high = Py_None; __pyx_t_2 = __pyx_f_8pysndlib_3clm_check_range(__pyx_n_s_size, __pyx_t_1, 0, &__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3577, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3578:
+3579: cdef double [:] initial_contents_view = None
__pyx_t_4 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(Py_None, PyBUF_WRITABLE); if (unlikely(!__pyx_t_4.memview)) __PYX_ERR(0, 3579, __pyx_L1_error) __pyx_v_initial_contents_view = __pyx_t_4; __pyx_t_4.memview = NULL; __pyx_t_4.data = NULL;
3580:
+3581: if not max_size:
__pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_max_size); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 3581, __pyx_L1_error) __pyx_t_6 = (!__pyx_t_5); if (__pyx_t_6) { /* … */ }
+3582: max_size = size
__pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v_size); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3582, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF_SET(__pyx_v_max_size, __pyx_t_2); __pyx_t_2 = 0;
3583:
+3584: if max_size != size and interp_type == Interp.NONE:
__pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v_size); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3584, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_1 = PyObject_RichCompare(__pyx_v_max_size, __pyx_t_2, Py_NE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3584, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 3584, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_5) { } else { __pyx_t_6 = __pyx_t_5; goto __pyx_L5_bool_binop_done; } __pyx_t_5 = (__pyx_v_interp_type == __pyx_e_8pysndlib_3clm_NONE); __pyx_t_6 = __pyx_t_5; __pyx_L5_bool_binop_done:; if (__pyx_t_6) { /* … */ }
+3585: interp_type = Interp.LAGRANGE #think this is correct from clm2xen.c
__pyx_v_interp_type = __pyx_e_8pysndlib_3clm_LAGRANGE;
3586:
+3587: if initial_contents is not None:
__pyx_t_6 = (__pyx_v_initial_contents != Py_None);
if (__pyx_t_6) {
/* … */
goto __pyx_L7;
}
+3588: if isinstance(initial_contents, list):
__pyx_t_6 = PyList_Check(__pyx_v_initial_contents);
if (__pyx_t_6) {
/* … */
}
+3589: initial_contents = np.array(initial_contents)
__Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3589, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_array); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3589, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = NULL; __pyx_t_8 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_7))) { __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_7); if (likely(__pyx_t_2)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7); __Pyx_INCREF(__pyx_t_2); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_7, function); __pyx_t_8 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_v_initial_contents}; __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_7, __pyx_callargs+1-__pyx_t_8, 1+__pyx_t_8); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3589, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; } __Pyx_DECREF_SET(__pyx_v_initial_contents, __pyx_t_1); __pyx_t_1 = 0;
+3590: check_ndim(initial_contents)
__pyx_t_1 = __pyx_f_8pysndlib_3clm_check_ndim(__pyx_v_initial_contents, 0, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3590, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+3591: initial_contents_view = initial_contents
__pyx_t_4 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_v_initial_contents, PyBUF_WRITABLE); if (unlikely(!__pyx_t_4.memview)) __PYX_ERR(0, 3591, __pyx_L1_error) __PYX_XCLEAR_MEMVIEW(&__pyx_v_initial_contents_view, 1); __pyx_v_initial_contents_view = __pyx_t_4; __pyx_t_4.memview = NULL; __pyx_t_4.data = NULL;
3592:
+3593: elif initial_element:
__pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_initial_element); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 3593, __pyx_L1_error) if (__pyx_t_6) { /* … */ } __pyx_L7:;
+3594: initial_contents = np.zeros(max_size, dtype=np.double)
__Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3594, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_zeros); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3594, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3594, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_v_max_size); __Pyx_GIVEREF(__pyx_v_max_size); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_max_size)) __PYX_ERR(0, 3594, __pyx_L1_error); __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3594, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 3594, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_double); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 3594, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_dtype, __pyx_t_10) < 0) __PYX_ERR(0, 3594, __pyx_L1_error) __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 3594, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF_SET(__pyx_v_initial_contents, __pyx_t_10); __pyx_t_10 = 0;
+3595: check_ndim(initial_contents)
__pyx_t_10 = __pyx_f_8pysndlib_3clm_check_ndim(__pyx_v_initial_contents, 0, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 3595, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+3596: initial_contents.fill(initial_element)
__pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_initial_contents, __pyx_n_s_fill); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3596, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_1 = NULL; __pyx_t_8 = 0; #if CYTHON_UNPACK_METHODS if (likely(PyMethod_Check(__pyx_t_2))) { __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_1)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_1); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); __pyx_t_8 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_v_initial_element}; __pyx_t_10 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_8, 1+__pyx_t_8); __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 3596, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+3597: initial_contents_view = initial_contents
__pyx_t_4 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_v_initial_contents, PyBUF_WRITABLE); if (unlikely(!__pyx_t_4.memview)) __PYX_ERR(0, 3597, __pyx_L1_error) __PYX_XCLEAR_MEMVIEW(&__pyx_v_initial_contents_view, 1); __pyx_v_initial_contents_view = __pyx_t_4; __pyx_t_4.memview = NULL; __pyx_t_4.data = NULL;
3598:
+3599: if initial_contents_view is not None:
__pyx_t_6 = (((PyObject *) __pyx_v_initial_contents_view.memview) != Py_None);
if (__pyx_t_6) {
/* … */
goto __pyx_L9;
}
+3600: gen = mus_any.from_ptr(cclm.mus_make_delay(size, &initial_contents_view[0], max_size, <cclm.mus_interp_t>interp_type))
__pyx_t_11 = 0;
__pyx_t_8 = -1;
if (__pyx_t_11 < 0) {
__pyx_t_11 += __pyx_v_initial_contents_view.shape[0];
if (unlikely(__pyx_t_11 < 0)) __pyx_t_8 = 0;
} else if (unlikely(__pyx_t_11 >= __pyx_v_initial_contents_view.shape[0])) __pyx_t_8 = 0;
if (unlikely(__pyx_t_8 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_8);
__PYX_ERR(0, 3600, __pyx_L1_error)
}
__pyx_t_8 = __Pyx_PyInt_As_int(__pyx_v_max_size); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3600, __pyx_L1_error)
__pyx_t_10 = ((PyObject *)__pyx_vtabptr_8pysndlib_3clm_mus_any->from_ptr(mus_make_delay(__pyx_v_size, (&(*((double *) ( /* dim=0 */ (__pyx_v_initial_contents_view.data + __pyx_t_11 * __pyx_v_initial_contents_view.strides[0]) )))), __pyx_t_8, ((mus_interp_t)__pyx_v_interp_type)), NULL)); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 3600, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_10);
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_t_10);
__pyx_t_10 = 0;
3601: else:
+3602: gen = mus_any.from_ptr(cclm.mus_make_delay(size, NULL, max_size, <cclm.mus_interp_t>interp_type))
/*else*/ {
__pyx_t_8 = __Pyx_PyInt_As_int(__pyx_v_max_size); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3602, __pyx_L1_error)
__pyx_t_10 = ((PyObject *)__pyx_vtabptr_8pysndlib_3clm_mus_any->from_ptr(mus_make_delay(__pyx_v_size, NULL, __pyx_t_8, ((mus_interp_t)__pyx_v_interp_type)), NULL)); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 3602, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_10);
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_t_10);
__pyx_t_10 = 0;
}
__pyx_L9:;
3603:
+3604: gen.cache_append(initial_contents)
__pyx_t_10 = ((struct __pyx_vtabstruct_8pysndlib_3clm_mus_any *)__pyx_v_gen->__pyx_vtab)->cache_append(__pyx_v_gen, __pyx_v_initial_contents, 0); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 3604, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+3605: return gen
__Pyx_XDECREF((PyObject *)__pyx_r); __Pyx_INCREF((PyObject *)__pyx_v_gen); __pyx_r = __pyx_v_gen; goto __pyx_L0;
3606:
+3607: cpdef cython.double delay(mus_any gen, cython.double insig, cython.double pm=0.0):
static PyObject *__pyx_pw_8pysndlib_3clm_363delay(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static double __pyx_f_8pysndlib_3clm_delay(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, double __pyx_v_insig, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_8pysndlib_3clm_delay *__pyx_optional_args) {
double __pyx_v_pm = ((double)0.0);
double __pyx_r;
if (__pyx_optional_args) {
if (__pyx_optional_args->__pyx_n > 0) {
__pyx_v_pm = __pyx_optional_args->pm;
}
}
/* … */
/* function exit code */
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_363delay(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_362delay, "\n delay val according to the delay line's length and pm ('phase-modulation').\n if pm is greater than 0.0, the max-size argument used to create gen should have accommodated \n its maximum value. \n \n :param gen: delay gen\n :param insig: input value\n :param pm: change \\in delay length size. can be + or -\n :rtype: float\n\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_363delay = {"delay", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_363delay, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_362delay};
static PyObject *__pyx_pw_8pysndlib_3clm_363delay(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = 0;
double __pyx_v_insig;
double __pyx_v_pm;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("delay (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gen,&__pyx_n_s_insig,&__pyx_n_s_pm,0};
PyObject* values[3] = {0,0,0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_gen)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3607, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_insig)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3607, __pyx_L3_error)
else {
__Pyx_RaiseArgtupleInvalid("delay", 0, 2, 3, 1); __PYX_ERR(0, 3607, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 2:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pm);
if (value) { values[2] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3607, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "delay") < 0)) __PYX_ERR(0, 3607, __pyx_L3_error)
}
} else {
switch (__pyx_nargs) {
case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
break;
default: goto __pyx_L5_argtuple_error;
}
}
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)values[0]);
__pyx_v_insig = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_insig == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 3607, __pyx_L3_error)
if (values[2]) {
__pyx_v_pm = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_pm == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 3607, __pyx_L3_error)
} else {
__pyx_v_pm = ((double)0.0);
}
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("delay", 0, 2, 3, __pyx_nargs); __PYX_ERR(0, 3607, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.delay", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gen), __pyx_ptype_8pysndlib_3clm_mus_any, 1, "gen", 0))) __PYX_ERR(0, 3607, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_362delay(__pyx_self, __pyx_v_gen, __pyx_v_insig, __pyx_v_pm);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_362delay(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, double __pyx_v_insig, double __pyx_v_pm) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_2.__pyx_n = 1;
__pyx_t_2.pm = __pyx_v_pm;
__pyx_t_1 = __pyx_f_8pysndlib_3clm_delay(__pyx_v_gen, __pyx_v_insig, 0, &__pyx_t_2); if (unlikely(__pyx_t_1 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 3607, __pyx_L1_error)
__pyx_t_3 = PyFloat_FromDouble(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3607, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__pyx_r = __pyx_t_3;
__pyx_t_3 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_3);
__Pyx_AddTraceback("pysndlib.clm.delay", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_tuple__448 = PyTuple_Pack(3, __pyx_n_s_gen, __pyx_n_s_insig, __pyx_n_s_pm); if (unlikely(!__pyx_tuple__448)) __PYX_ERR(0, 3607, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__448);
__Pyx_GIVEREF(__pyx_tuple__448);
__pyx_codeobj__449 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__448, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_delay, 3607, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__449)) __PYX_ERR(0, 3607, __pyx_L1_error)
/* … */
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_363delay, 0, __pyx_n_s_delay, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__449)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 3607, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
__Pyx_CyFunction_SetDefaultsTuple(__pyx_t_40, __pyx_tuple__450);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_delay, __pyx_t_40) < 0) __PYX_ERR(0, 3607, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
__pyx_tuple__450 = PyTuple_Pack(1, __pyx_float_0_0); if (unlikely(!__pyx_tuple__450)) __PYX_ERR(0, 3607, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__450);
__Pyx_GIVEREF(__pyx_tuple__450);
3608: """
3609: delay val according to the delay line's length and pm ('phase-modulation').
3610: if pm is greater than 0.0, the max-size argument used to create gen should have accommodated
3611: its maximum value.
3612:
3613: :param gen: delay gen
3614: :param insig: input value
3615: :param pm: change \in delay length size. can be + or -
3616: :rtype: float
3617:
3618: """
+3619: return cclm.mus_delay(gen._ptr, insig, pm)
__pyx_r = mus_delay(__pyx_v_gen->_ptr, __pyx_v_insig, __pyx_v_pm); goto __pyx_L0;
3620:
3621:
+3622: cpdef cython.double delay_unmodulated(mus_any gen, cython.double insig):
static PyObject *__pyx_pw_8pysndlib_3clm_365delay_unmodulated(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static double __pyx_f_8pysndlib_3clm_delay_unmodulated(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, double __pyx_v_insig, CYTHON_UNUSED int __pyx_skip_dispatch) {
double __pyx_r;
/* … */
/* function exit code */
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_365delay_unmodulated(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_364delay_unmodulated, "\n delay val according to the delay line's length and pm ('phase-modulation').\n if pm is greater than 0.0, the max-size argument used to create gen should have accommodated \n its maximum value. \n \n :param gen: delay gen\n :param insig: input value\n :rtype: float\n\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_365delay_unmodulated = {"delay_unmodulated", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_365delay_unmodulated, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_364delay_unmodulated};
static PyObject *__pyx_pw_8pysndlib_3clm_365delay_unmodulated(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = 0;
double __pyx_v_insig;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("delay_unmodulated (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gen,&__pyx_n_s_insig,0};
PyObject* values[2] = {0,0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_gen)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3622, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_insig)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3622, __pyx_L3_error)
else {
__Pyx_RaiseArgtupleInvalid("delay_unmodulated", 1, 2, 2, 1); __PYX_ERR(0, 3622, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "delay_unmodulated") < 0)) __PYX_ERR(0, 3622, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 2)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
}
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)values[0]);
__pyx_v_insig = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_insig == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 3622, __pyx_L3_error)
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("delay_unmodulated", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 3622, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.delay_unmodulated", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gen), __pyx_ptype_8pysndlib_3clm_mus_any, 1, "gen", 0))) __PYX_ERR(0, 3622, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_364delay_unmodulated(__pyx_self, __pyx_v_gen, __pyx_v_insig);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_364delay_unmodulated(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, double __pyx_v_insig) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8pysndlib_3clm_delay_unmodulated(__pyx_v_gen, __pyx_v_insig, 0); if (unlikely(__pyx_t_1 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 3622, __pyx_L1_error)
__pyx_t_2 = PyFloat_FromDouble(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3622, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("pysndlib.clm.delay_unmodulated", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_365delay_unmodulated, 0, __pyx_n_s_delay_unmodulated, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__451)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 3622, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_delay_unmodulated, __pyx_t_40) < 0) __PYX_ERR(0, 3622, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
/* … */
__pyx_codeobj__451 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__380, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_delay_unmodulated, 3622, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__451)) __PYX_ERR(0, 3622, __pyx_L1_error)
3623: """
3624: delay val according to the delay line's length and pm ('phase-modulation').
3625: if pm is greater than 0.0, the max-size argument used to create gen should have accommodated
3626: its maximum value.
3627:
3628: :param gen: delay gen
3629: :param insig: input value
3630: :rtype: float
3631:
3632: """
+3633: return cclm.mus_delay_unmodulated(gen._ptr, insig)
__pyx_r = mus_delay_unmodulated(__pyx_v_gen->_ptr, __pyx_v_insig); goto __pyx_L0;
3634:
+3635: cpdef bint is_delay(mus_any gen):
static PyObject *__pyx_pw_8pysndlib_3clm_367is_delay(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static int __pyx_f_8pysndlib_3clm_is_delay(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, CYTHON_UNUSED int __pyx_skip_dispatch) {
int __pyx_r;
/* … */
/* function exit code */
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_367is_delay(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_366is_delay, "\n returns True if gen is a delay.\n \n :param gen: gen\n :rtype: bool\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_367is_delay = {"is_delay", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_367is_delay, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_366is_delay};
static PyObject *__pyx_pw_8pysndlib_3clm_367is_delay(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("is_delay (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gen,0};
PyObject* values[1] = {0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_gen)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3635, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "is_delay") < 0)) __PYX_ERR(0, 3635, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 1)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
}
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)values[0]);
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("is_delay", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 3635, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.is_delay", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gen), __pyx_ptype_8pysndlib_3clm_mus_any, 1, "gen", 0))) __PYX_ERR(0, 3635, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_366is_delay(__pyx_self, __pyx_v_gen);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_366is_delay(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8pysndlib_3clm_is_delay(__pyx_v_gen, 0); if (unlikely(__pyx_t_1 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3635, __pyx_L1_error)
__pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3635, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("pysndlib.clm.is_delay", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_367is_delay, 0, __pyx_n_s_is_delay, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__452)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 3635, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_is_delay, __pyx_t_40) < 0) __PYX_ERR(0, 3635, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
/* … */
__pyx_codeobj__452 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__56, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_is_delay, 3635, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__452)) __PYX_ERR(0, 3635, __pyx_L1_error)
3636: """
3637: returns True if gen is a delay.
3638:
3639: :param gen: gen
3640: :rtype: bool
3641: """
+3642: return cclm.mus_is_delay(gen._ptr)
__pyx_r = mus_is_delay(__pyx_v_gen->_ptr); goto __pyx_L0;
3643:
+3644: cpdef cython.double tap(mus_any gen, offset=0.):
static PyObject *__pyx_pw_8pysndlib_3clm_369tap(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static double __pyx_f_8pysndlib_3clm_tap(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_8pysndlib_3clm_tap *__pyx_optional_args) {
PyObject *__pyx_v_offset = ((PyObject *)__pyx_float_0_);
double __pyx_r;
if (__pyx_optional_args) {
if (__pyx_optional_args->__pyx_n > 0) {
__pyx_v_offset = __pyx_optional_args->offset;
}
}
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_AddTraceback("pysndlib.clm.tap", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = -1;
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_369tap(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_368tap, "\n tap the delay mus_any offset by pm\n \n :param gen: delay gen\n :param offset: offset in samples from output point\n :rtype: float\n \n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_369tap = {"tap", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_369tap, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_368tap};
static PyObject *__pyx_pw_8pysndlib_3clm_369tap(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = 0;
PyObject *__pyx_v_offset = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("tap (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gen,&__pyx_n_s_offset,0};
PyObject* values[2] = {0,0};
values[1] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)__pyx_float_0_));
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_gen)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3644, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_offset);
if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3644, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "tap") < 0)) __PYX_ERR(0, 3644, __pyx_L3_error)
}
} else {
switch (__pyx_nargs) {
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
break;
default: goto __pyx_L5_argtuple_error;
}
}
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)values[0]);
__pyx_v_offset = values[1];
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("tap", 0, 1, 2, __pyx_nargs); __PYX_ERR(0, 3644, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.tap", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gen), __pyx_ptype_8pysndlib_3clm_mus_any, 1, "gen", 0))) __PYX_ERR(0, 3644, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_368tap(__pyx_self, __pyx_v_gen, __pyx_v_offset);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_368tap(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, PyObject *__pyx_v_offset) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_2.__pyx_n = 1;
__pyx_t_2.offset = __pyx_v_offset;
__pyx_t_1 = __pyx_f_8pysndlib_3clm_tap(__pyx_v_gen, 0, &__pyx_t_2); if (unlikely(__pyx_t_1 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 3644, __pyx_L1_error)
__pyx_t_3 = PyFloat_FromDouble(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3644, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__pyx_r = __pyx_t_3;
__pyx_t_3 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_3);
__Pyx_AddTraceback("pysndlib.clm.tap", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_tuple__453 = PyTuple_Pack(2, __pyx_n_s_gen, __pyx_n_s_offset); if (unlikely(!__pyx_tuple__453)) __PYX_ERR(0, 3644, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__453);
__Pyx_GIVEREF(__pyx_tuple__453);
__pyx_codeobj__454 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__453, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_tap, 3644, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__454)) __PYX_ERR(0, 3644, __pyx_L1_error)
/* … */
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_369tap, 0, __pyx_n_s_tap, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__454)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 3644, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
__Pyx_CyFunction_SetDefaultsTuple(__pyx_t_40, __pyx_tuple__455);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_tap, __pyx_t_40) < 0) __PYX_ERR(0, 3644, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
__pyx_tuple__455 = PyTuple_Pack(1, __pyx_float_0_); if (unlikely(!__pyx_tuple__455)) __PYX_ERR(0, 3644, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__455);
__Pyx_GIVEREF(__pyx_tuple__455);
3645: """
3646: tap the delay mus_any offset by pm
3647:
3648: :param gen: delay gen
3649: :param offset: offset in samples from output point
3650: :rtype: float
3651:
3652: """
3653:
+3654: return cclm.mus_tap(gen._ptr, offset)
__pyx_t_1 = __pyx_PyFloat_AsDouble(__pyx_v_offset); if (unlikely((__pyx_t_1 == ((mus_float_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 3654, __pyx_L1_error) __pyx_r = mus_tap(__pyx_v_gen->_ptr, __pyx_t_1); goto __pyx_L0;
3655:
+3656: cpdef cython.double tap_unmodulated(mus_any gen):
static PyObject *__pyx_pw_8pysndlib_3clm_371tap_unmodulated(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static double __pyx_f_8pysndlib_3clm_tap_unmodulated(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, CYTHON_UNUSED int __pyx_skip_dispatch) {
double __pyx_r;
/* … */
/* function exit code */
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_371tap_unmodulated(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_370tap_unmodulated, "\n tap the delay mus_any offset by pm\n \n :param gen: delay gen\n :param offset: offset in samples from output point\n :rtype: float\n \n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_371tap_unmodulated = {"tap_unmodulated", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_371tap_unmodulated, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_370tap_unmodulated};
static PyObject *__pyx_pw_8pysndlib_3clm_371tap_unmodulated(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("tap_unmodulated (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gen,0};
PyObject* values[1] = {0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_gen)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3656, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "tap_unmodulated") < 0)) __PYX_ERR(0, 3656, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 1)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
}
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)values[0]);
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("tap_unmodulated", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 3656, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.tap_unmodulated", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gen), __pyx_ptype_8pysndlib_3clm_mus_any, 1, "gen", 0))) __PYX_ERR(0, 3656, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_370tap_unmodulated(__pyx_self, __pyx_v_gen);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_370tap_unmodulated(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8pysndlib_3clm_tap_unmodulated(__pyx_v_gen, 0); if (unlikely(__pyx_t_1 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 3656, __pyx_L1_error)
__pyx_t_2 = PyFloat_FromDouble(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3656, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("pysndlib.clm.tap_unmodulated", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_371tap_unmodulated, 0, __pyx_n_s_tap_unmodulated, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__456)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 3656, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_tap_unmodulated, __pyx_t_40) < 0) __PYX_ERR(0, 3656, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
/* … */
__pyx_codeobj__456 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__56, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_tap_unmodulated, 3656, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__456)) __PYX_ERR(0, 3656, __pyx_L1_error)
3657: """
3658: tap the delay mus_any offset by pm
3659:
3660: :param gen: delay gen
3661: :param offset: offset in samples from output point
3662: :rtype: float
3663:
3664: """
+3665: return cclm.mus_tap_unmodulated(gen._ptr)
__pyx_r = mus_tap_unmodulated(__pyx_v_gen->_ptr); goto __pyx_L0;
3666:
+3667: cpdef bint is_tap(mus_any gen):
static PyObject *__pyx_pw_8pysndlib_3clm_373is_tap(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static int __pyx_f_8pysndlib_3clm_is_tap(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, CYTHON_UNUSED int __pyx_skip_dispatch) {
int __pyx_r;
/* … */
/* function exit code */
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_373is_tap(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_372is_tap, "\n returns True if gen is a tap.\n \n :param gen: gen\n :rtype: bool\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_373is_tap = {"is_tap", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_373is_tap, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_372is_tap};
static PyObject *__pyx_pw_8pysndlib_3clm_373is_tap(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("is_tap (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gen,0};
PyObject* values[1] = {0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_gen)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3667, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "is_tap") < 0)) __PYX_ERR(0, 3667, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 1)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
}
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)values[0]);
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("is_tap", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 3667, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.is_tap", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gen), __pyx_ptype_8pysndlib_3clm_mus_any, 1, "gen", 0))) __PYX_ERR(0, 3667, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_372is_tap(__pyx_self, __pyx_v_gen);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_372is_tap(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8pysndlib_3clm_is_tap(__pyx_v_gen, 0); if (unlikely(__pyx_t_1 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3667, __pyx_L1_error)
__pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3667, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("pysndlib.clm.is_tap", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_373is_tap, 0, __pyx_n_s_is_tap, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__457)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 3667, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_is_tap, __pyx_t_40) < 0) __PYX_ERR(0, 3667, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
/* … */
__pyx_codeobj__457 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__56, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_is_tap, 3667, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__457)) __PYX_ERR(0, 3667, __pyx_L1_error)
3668: """
3669: returns True if gen is a tap.
3670:
3671: :param gen: gen
3672: :rtype: bool
3673: """
+3674: return cclm.mus_is_tap(gen._ptr)
__pyx_r = mus_is_tap(__pyx_v_gen->_ptr); goto __pyx_L0;
3675:
+3676: cpdef cython.double delay_tick(mus_any gen, cython.double insig ):
static PyObject *__pyx_pw_8pysndlib_3clm_375delay_tick(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static double __pyx_f_8pysndlib_3clm_delay_tick(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, double __pyx_v_insig, CYTHON_UNUSED int __pyx_skip_dispatch) {
double __pyx_r;
/* … */
/* function exit code */
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_375delay_tick(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_374delay_tick, "\n delay val according to the delay line's length. this merely 'ticks' the delay line forward.\n the argument 'insi' is returned.\n \n :param gen: delay gen\n :rtype: float\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_375delay_tick = {"delay_tick", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_375delay_tick, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_374delay_tick};
static PyObject *__pyx_pw_8pysndlib_3clm_375delay_tick(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = 0;
double __pyx_v_insig;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("delay_tick (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gen,&__pyx_n_s_insig,0};
PyObject* values[2] = {0,0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_gen)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3676, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_insig)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3676, __pyx_L3_error)
else {
__Pyx_RaiseArgtupleInvalid("delay_tick", 1, 2, 2, 1); __PYX_ERR(0, 3676, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "delay_tick") < 0)) __PYX_ERR(0, 3676, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 2)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
}
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)values[0]);
__pyx_v_insig = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_insig == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 3676, __pyx_L3_error)
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("delay_tick", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 3676, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.delay_tick", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gen), __pyx_ptype_8pysndlib_3clm_mus_any, 1, "gen", 0))) __PYX_ERR(0, 3676, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_374delay_tick(__pyx_self, __pyx_v_gen, __pyx_v_insig);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_374delay_tick(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, double __pyx_v_insig) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8pysndlib_3clm_delay_tick(__pyx_v_gen, __pyx_v_insig, 0); if (unlikely(__pyx_t_1 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 3676, __pyx_L1_error)
__pyx_t_2 = PyFloat_FromDouble(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3676, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("pysndlib.clm.delay_tick", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_375delay_tick, 0, __pyx_n_s_delay_tick, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__458)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 3676, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_delay_tick, __pyx_t_40) < 0) __PYX_ERR(0, 3676, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
/* … */
__pyx_codeobj__458 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__380, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_delay_tick, 3676, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__458)) __PYX_ERR(0, 3676, __pyx_L1_error)
3677: """
3678: delay val according to the delay line's length. this merely 'ticks' the delay line forward.
3679: the argument 'insi' is returned.
3680:
3681: :param gen: delay gen
3682: :rtype: float
3683: """
+3684: return cclm.mus_delay_tick(gen._ptr, insig)
__pyx_r = mus_delay_tick(__pyx_v_gen->_ptr, __pyx_v_insig); goto __pyx_L0;
3685:
3686:
3687: # ---------------- comb ---------------- #
+3688: cpdef mus_any make_comb(cython.double feedback=1.0,size=None, initial_contents=None, initial_element=None, max_size=None, Interp interp_type=Interp.NONE):
static PyObject *__pyx_pw_8pysndlib_3clm_377make_comb(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_f_8pysndlib_3clm_make_comb(CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_8pysndlib_3clm_make_comb *__pyx_optional_args) {
double __pyx_v_feedback = ((double)1.0);
PyObject *__pyx_v_size = ((PyObject *)Py_None);
PyObject *__pyx_v_initial_contents = ((PyObject *)Py_None);
PyObject *__pyx_v_initial_element = ((PyObject *)Py_None);
PyObject *__pyx_v_max_size = ((PyObject *)Py_None);
enum __pyx_t_8pysndlib_3clm_Interp __pyx_v_interp_type = __pyx_k__44;
__Pyx_memviewslice __pyx_v_initial_contents_view = { 0, 0, { 0 }, { 0 }, { 0 } };
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = NULL;
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_r = NULL;
if (__pyx_optional_args) {
if (__pyx_optional_args->__pyx_n > 0) {
__pyx_v_feedback = __pyx_optional_args->feedback;
if (__pyx_optional_args->__pyx_n > 1) {
__pyx_v_size = __pyx_optional_args->size;
if (__pyx_optional_args->__pyx_n > 2) {
__pyx_v_initial_contents = __pyx_optional_args->initial_contents;
if (__pyx_optional_args->__pyx_n > 3) {
__pyx_v_initial_element = __pyx_optional_args->initial_element;
if (__pyx_optional_args->__pyx_n > 4) {
__pyx_v_max_size = __pyx_optional_args->max_size;
if (__pyx_optional_args->__pyx_n > 5) {
__pyx_v_interp_type = __pyx_optional_args->interp_type;
}
}
}
}
}
}
}
__Pyx_INCREF(__pyx_v_initial_contents);
__Pyx_INCREF(__pyx_v_max_size);
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__PYX_XCLEAR_MEMVIEW(&__pyx_t_3, 1);
__Pyx_XDECREF(__pyx_t_6);
__Pyx_XDECREF(__pyx_t_7);
__Pyx_AddTraceback("pysndlib.clm.make_comb", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__PYX_XCLEAR_MEMVIEW(&__pyx_v_initial_contents_view, 1);
__Pyx_XDECREF((PyObject *)__pyx_v_gen);
__Pyx_XDECREF(__pyx_v_initial_contents);
__Pyx_XDECREF(__pyx_v_max_size);
__Pyx_XGIVEREF((PyObject *)__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_377make_comb(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_376make_comb, "\n return a new comb filter (a delay line with a scaler on the feedback) of size elements. if the comb\n length will be changing at run-time, max-size sets its maximum length. \n \n :param feedback: scaler on feedback\n :param size: delay length \\in samples\n :param initial_contents: delay line's initial values\n :param initial_element: delay line's initial element\n :param max_size: maximum delay size \\in case the delay changes\n :param type: interpolation type\n :return: comb gen\n :rtype: mus_any\n \n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_377make_comb = {"make_comb", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_377make_comb, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_376make_comb};
static PyObject *__pyx_pw_8pysndlib_3clm_377make_comb(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
double __pyx_v_feedback;
PyObject *__pyx_v_size = 0;
PyObject *__pyx_v_initial_contents = 0;
PyObject *__pyx_v_initial_element = 0;
PyObject *__pyx_v_max_size = 0;
enum __pyx_t_8pysndlib_3clm_Interp __pyx_v_interp_type;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("make_comb (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_feedback,&__pyx_n_s_size,&__pyx_n_s_initial_contents,&__pyx_n_s_initial_element,&__pyx_n_s_max_size,&__pyx_n_s_interp_type,0};
PyObject* values[6] = {0,0,0,0,0,0};
values[1] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
values[2] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
values[3] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
values[4] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 6: values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5);
CYTHON_FALLTHROUGH;
case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4);
CYTHON_FALLTHROUGH;
case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
CYTHON_FALLTHROUGH;
case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_feedback);
if (value) { values[0] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3688, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 1:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_size);
if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3688, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 2:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_initial_contents);
if (value) { values[2] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3688, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 3:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_initial_element);
if (value) { values[3] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3688, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 4:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_max_size);
if (value) { values[4] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3688, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 5:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_interp_type);
if (value) { values[5] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3688, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "make_comb") < 0)) __PYX_ERR(0, 3688, __pyx_L3_error)
}
} else {
switch (__pyx_nargs) {
case 6: values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5);
CYTHON_FALLTHROUGH;
case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4);
CYTHON_FALLTHROUGH;
case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
CYTHON_FALLTHROUGH;
case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
}
if (values[0]) {
__pyx_v_feedback = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_feedback == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 3688, __pyx_L3_error)
} else {
__pyx_v_feedback = ((double)1.0);
}
__pyx_v_size = values[1];
__pyx_v_initial_contents = values[2];
__pyx_v_initial_element = values[3];
__pyx_v_max_size = values[4];
if (values[5]) {
__pyx_v_interp_type = ((enum __pyx_t_8pysndlib_3clm_Interp)__Pyx_PyInt_As_enum____pyx_t_8pysndlib_3clm_Interp(values[5])); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3688, __pyx_L3_error)
} else {
__pyx_v_interp_type = __pyx_k__44;
}
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("make_comb", 0, 0, 6, __pyx_nargs); __PYX_ERR(0, 3688, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.make_comb", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_8pysndlib_3clm_376make_comb(__pyx_self, __pyx_v_feedback, __pyx_v_size, __pyx_v_initial_contents, __pyx_v_initial_element, __pyx_v_max_size, __pyx_v_interp_type);
/* function exit code */
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_376make_comb(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_feedback, PyObject *__pyx_v_size, PyObject *__pyx_v_initial_contents, PyObject *__pyx_v_initial_element, PyObject *__pyx_v_max_size, enum __pyx_t_8pysndlib_3clm_Interp __pyx_v_interp_type) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_2.__pyx_n = 6;
__pyx_t_2.feedback = __pyx_v_feedback;
__pyx_t_2.size = __pyx_v_size;
__pyx_t_2.initial_contents = __pyx_v_initial_contents;
__pyx_t_2.initial_element = __pyx_v_initial_element;
__pyx_t_2.max_size = __pyx_v_max_size;
__pyx_t_2.interp_type = __pyx_v_interp_type;
__pyx_t_1 = ((PyObject *)__pyx_f_8pysndlib_3clm_make_comb(0, &__pyx_t_2)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3688, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("pysndlib.clm.make_comb", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_k__44 = __pyx_e_8pysndlib_3clm_NONE;
/* … */
__pyx_tuple__459 = PyTuple_Pack(6, __pyx_n_s_feedback, __pyx_n_s_size, __pyx_n_s_initial_contents, __pyx_n_s_initial_element, __pyx_n_s_max_size, __pyx_n_s_interp_type); if (unlikely(!__pyx_tuple__459)) __PYX_ERR(0, 3688, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__459);
__Pyx_GIVEREF(__pyx_tuple__459);
__pyx_t_40 = __Pyx_Enum_Interp_to_py(__pyx_e_8pysndlib_3clm_NONE); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 3688, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
__pyx_t_43 = PyTuple_New(6); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 3688, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
__Pyx_INCREF(__pyx_float_1_0);
__Pyx_GIVEREF(__pyx_float_1_0);
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_43, 0, __pyx_float_1_0)) __PYX_ERR(0, 3688, __pyx_L1_error);
__Pyx_INCREF(Py_None);
__Pyx_GIVEREF(Py_None);
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_43, 1, Py_None)) __PYX_ERR(0, 3688, __pyx_L1_error);
__Pyx_INCREF(Py_None);
__Pyx_GIVEREF(Py_None);
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_43, 2, Py_None)) __PYX_ERR(0, 3688, __pyx_L1_error);
__Pyx_INCREF(Py_None);
__Pyx_GIVEREF(Py_None);
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_43, 3, Py_None)) __PYX_ERR(0, 3688, __pyx_L1_error);
__Pyx_INCREF(Py_None);
__Pyx_GIVEREF(Py_None);
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_43, 4, Py_None)) __PYX_ERR(0, 3688, __pyx_L1_error);
__Pyx_GIVEREF(__pyx_t_40);
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_43, 5, __pyx_t_40)) __PYX_ERR(0, 3688, __pyx_L1_error);
__pyx_t_40 = 0;
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_377make_comb, 0, __pyx_n_s_make_comb, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__460)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 3688, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
__Pyx_CyFunction_SetDefaultsTuple(__pyx_t_40, __pyx_t_43);
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
if (PyDict_SetItem(__pyx_d, __pyx_n_s_make_comb, __pyx_t_40) < 0) __PYX_ERR(0, 3688, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
__pyx_codeobj__460 = (PyObject*)__Pyx_PyCode_New(6, 0, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__459, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_make_comb, 3688, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__460)) __PYX_ERR(0, 3688, __pyx_L1_error)
/* … */
struct __pyx_opt_args_8pysndlib_3clm_make_comb {
int __pyx_n;
double feedback;
PyObject *size;
PyObject *initial_contents;
PyObject *initial_element;
PyObject *max_size;
enum __pyx_t_8pysndlib_3clm_Interp interp_type;
};
3689: """
3690: return a new comb filter (a delay line with a scaler on the feedback) of size elements. if the comb
3691: length will be changing at run-time, max-size sets its maximum length.
3692:
3693: :param feedback: scaler on feedback
3694: :param size: delay length \in samples
3695: :param initial_contents: delay line's initial values
3696: :param initial_element: delay line's initial element
3697: :param max_size: maximum delay size \in case the delay changes
3698: :param type: interpolation type
3699: :return: comb gen
3700: :rtype: mus_any
3701:
3702: """
3703:
+3704: check_range('size', size, 0.0, None)
__pyx_t_2.__pyx_n = 2; __pyx_t_2.low = __pyx_float_0_0; __pyx_t_2.high = Py_None; __pyx_t_1 = __pyx_f_8pysndlib_3clm_check_range(__pyx_n_s_size, __pyx_v_size, 0, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3704, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3705:
+3706: cdef double [:] initial_contents_view = None
__pyx_t_3 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(Py_None, PyBUF_WRITABLE); if (unlikely(!__pyx_t_3.memview)) __PYX_ERR(0, 3706, __pyx_L1_error) __pyx_v_initial_contents_view = __pyx_t_3; __pyx_t_3.memview = NULL; __pyx_t_3.data = NULL;
3707:
+3708: if not max_size:
__pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_max_size); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 3708, __pyx_L1_error) __pyx_t_5 = (!__pyx_t_4); if (__pyx_t_5) { /* … */ }
+3709: max_size = size
__Pyx_INCREF(__pyx_v_size); __Pyx_DECREF_SET(__pyx_v_max_size, __pyx_v_size);
3710:
+3711: if max_size != size and interp_type == Interp.NONE:
__pyx_t_1 = PyObject_RichCompare(__pyx_v_max_size, __pyx_v_size, Py_NE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3711, __pyx_L1_error) __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 3711, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_4) { } else { __pyx_t_5 = __pyx_t_4; goto __pyx_L5_bool_binop_done; } __pyx_t_4 = (__pyx_v_interp_type == __pyx_e_8pysndlib_3clm_NONE); __pyx_t_5 = __pyx_t_4; __pyx_L5_bool_binop_done:; if (__pyx_t_5) { /* … */ }
+3712: interp_type = Interp.BEZIER #think this is correct from clm2xen.c
__pyx_v_interp_type = __pyx_e_8pysndlib_3clm_BEZIER;
3713:
+3714: if initial_contents is not None:
__pyx_t_5 = (__pyx_v_initial_contents != Py_None);
if (__pyx_t_5) {
/* … */
goto __pyx_L7;
}
+3715: if isinstance(initial_contents, list):
__pyx_t_5 = PyList_Check(__pyx_v_initial_contents);
if (__pyx_t_5) {
/* … */
}
+3716: initial_contents = np.array(initial_contents)
__Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3716, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_array); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3716, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_6 = NULL; __pyx_t_8 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_7))) { __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_7); if (likely(__pyx_t_6)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7); __Pyx_INCREF(__pyx_t_6); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_7, function); __pyx_t_8 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_v_initial_contents}; __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_7, __pyx_callargs+1-__pyx_t_8, 1+__pyx_t_8); __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3716, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; } __Pyx_DECREF_SET(__pyx_v_initial_contents, __pyx_t_1); __pyx_t_1 = 0;
+3717: check_ndim(initial_contents)
__pyx_t_1 = __pyx_f_8pysndlib_3clm_check_ndim(__pyx_v_initial_contents, 0, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3717, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+3718: initial_contents_view = initial_contents
__pyx_t_3 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_v_initial_contents, PyBUF_WRITABLE); if (unlikely(!__pyx_t_3.memview)) __PYX_ERR(0, 3718, __pyx_L1_error) __PYX_XCLEAR_MEMVIEW(&__pyx_v_initial_contents_view, 1); __pyx_v_initial_contents_view = __pyx_t_3; __pyx_t_3.memview = NULL; __pyx_t_3.data = NULL;
3719:
+3720: elif initial_element:
__pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_initial_element); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 3720, __pyx_L1_error) if (__pyx_t_5) { /* … */ } __pyx_L7:;
+3721: initial_contents = np.zeros(max_size)
__Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3721, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_zeros); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3721, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_7 = NULL; __pyx_t_8 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_6))) { __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6); if (likely(__pyx_t_7)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); __Pyx_INCREF(__pyx_t_7); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_6, function); __pyx_t_8 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_v_max_size}; __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+1-__pyx_t_8, 1+__pyx_t_8); __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3721, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; } __Pyx_DECREF_SET(__pyx_v_initial_contents, __pyx_t_1); __pyx_t_1 = 0;
+3722: check_ndim(initial_contents)
__pyx_t_1 = __pyx_f_8pysndlib_3clm_check_ndim(__pyx_v_initial_contents, 0, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3722, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+3723: initial_contents.fill(initial_element)
__pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_initial_contents, __pyx_n_s_fill); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3723, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_7 = NULL; __pyx_t_8 = 0; #if CYTHON_UNPACK_METHODS if (likely(PyMethod_Check(__pyx_t_6))) { __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6); if (likely(__pyx_t_7)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); __Pyx_INCREF(__pyx_t_7); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_6, function); __pyx_t_8 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_v_initial_element}; __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+1-__pyx_t_8, 1+__pyx_t_8); __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3723, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+3724: initial_contents_view = initial_contents
__pyx_t_3 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_v_initial_contents, PyBUF_WRITABLE); if (unlikely(!__pyx_t_3.memview)) __PYX_ERR(0, 3724, __pyx_L1_error) __PYX_XCLEAR_MEMVIEW(&__pyx_v_initial_contents_view, 1); __pyx_v_initial_contents_view = __pyx_t_3; __pyx_t_3.memview = NULL; __pyx_t_3.data = NULL;
3725:
+3726: if initial_contents_view is not None:
__pyx_t_5 = (((PyObject *) __pyx_v_initial_contents_view.memview) != Py_None);
if (__pyx_t_5) {
/* … */
goto __pyx_L9;
}
+3727: gen = mus_any.from_ptr(cclm.mus_make_comb(feedback, size, &initial_contents_view[0], max_size, <cclm.mus_interp_t>interp_type))
__pyx_t_8 = __Pyx_PyInt_As_int(__pyx_v_size); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3727, __pyx_L1_error) __pyx_t_9 = 0; __pyx_t_10 = -1; if (__pyx_t_9 < 0) { __pyx_t_9 += __pyx_v_initial_contents_view.shape[0]; if (unlikely(__pyx_t_9 < 0)) __pyx_t_10 = 0; } else if (unlikely(__pyx_t_9 >= __pyx_v_initial_contents_view.shape[0])) __pyx_t_10 = 0; if (unlikely(__pyx_t_10 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_10); __PYX_ERR(0, 3727, __pyx_L1_error) } __pyx_t_10 = __Pyx_PyInt_As_int(__pyx_v_max_size); if (unlikely((__pyx_t_10 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3727, __pyx_L1_error) __pyx_t_1 = ((PyObject *)__pyx_vtabptr_8pysndlib_3clm_mus_any->from_ptr(mus_make_comb(__pyx_v_feedback, __pyx_t_8, (&(*((double *) ( /* dim=0 */ (__pyx_v_initial_contents_view.data + __pyx_t_9 * __pyx_v_initial_contents_view.strides[0]) )))), __pyx_t_10, ((mus_interp_t)__pyx_v_interp_type)), NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3727, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_t_1); __pyx_t_1 = 0;
3728: else:
+3729: gen = mus_any.from_ptr(cclm.mus_make_comb(feedback, size, NULL, max_size, <cclm.mus_interp_t>interp_type))
/*else*/ {
__pyx_t_10 = __Pyx_PyInt_As_int(__pyx_v_size); if (unlikely((__pyx_t_10 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3729, __pyx_L1_error)
__pyx_t_8 = __Pyx_PyInt_As_int(__pyx_v_max_size); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3729, __pyx_L1_error)
__pyx_t_1 = ((PyObject *)__pyx_vtabptr_8pysndlib_3clm_mus_any->from_ptr(mus_make_comb(__pyx_v_feedback, __pyx_t_10, NULL, __pyx_t_8, ((mus_interp_t)__pyx_v_interp_type)), NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3729, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_t_1);
__pyx_t_1 = 0;
}
__pyx_L9:;
+3730: gen.cache_append(initial_contents)
__pyx_t_1 = ((struct __pyx_vtabstruct_8pysndlib_3clm_mus_any *)__pyx_v_gen->__pyx_vtab)->cache_append(__pyx_v_gen, __pyx_v_initial_contents, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3730, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+3731: return gen
__Pyx_XDECREF((PyObject *)__pyx_r); __Pyx_INCREF((PyObject *)__pyx_v_gen); __pyx_r = __pyx_v_gen; goto __pyx_L0;
3732:
+3733: cpdef cython.double comb(mus_any gen, cython.double insig, pm=None):
static PyObject *__pyx_pw_8pysndlib_3clm_379comb(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static double __pyx_f_8pysndlib_3clm_comb(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, double __pyx_v_insig, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_8pysndlib_3clm_comb *__pyx_optional_args) {
PyObject *__pyx_v_pm = ((PyObject *)Py_None);
double __pyx_r;
if (__pyx_optional_args) {
if (__pyx_optional_args->__pyx_n > 0) {
__pyx_v_pm = __pyx_optional_args->pm;
}
}
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_AddTraceback("pysndlib.clm.comb", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = -1;
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_379comb(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_378comb, "\n comb filter val, pm changes the delay length.\n \n :param gen: comb gen\n :param insig: input value\n :param pm: change \\in delay length size. can be + or -\n :rtype: float\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_379comb = {"comb", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_379comb, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_378comb};
static PyObject *__pyx_pw_8pysndlib_3clm_379comb(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = 0;
double __pyx_v_insig;
PyObject *__pyx_v_pm = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("comb (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gen,&__pyx_n_s_insig,&__pyx_n_s_pm,0};
PyObject* values[3] = {0,0,0};
values[2] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_gen)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3733, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_insig)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3733, __pyx_L3_error)
else {
__Pyx_RaiseArgtupleInvalid("comb", 0, 2, 3, 1); __PYX_ERR(0, 3733, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 2:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pm);
if (value) { values[2] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3733, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "comb") < 0)) __PYX_ERR(0, 3733, __pyx_L3_error)
}
} else {
switch (__pyx_nargs) {
case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
break;
default: goto __pyx_L5_argtuple_error;
}
}
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)values[0]);
__pyx_v_insig = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_insig == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 3733, __pyx_L3_error)
__pyx_v_pm = values[2];
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("comb", 0, 2, 3, __pyx_nargs); __PYX_ERR(0, 3733, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.comb", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gen), __pyx_ptype_8pysndlib_3clm_mus_any, 1, "gen", 0))) __PYX_ERR(0, 3733, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_378comb(__pyx_self, __pyx_v_gen, __pyx_v_insig, __pyx_v_pm);
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_378comb(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, double __pyx_v_insig, PyObject *__pyx_v_pm) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_2.__pyx_n = 1;
__pyx_t_2.pm = __pyx_v_pm;
__pyx_t_1 = __pyx_f_8pysndlib_3clm_comb(__pyx_v_gen, __pyx_v_insig, 0, &__pyx_t_2); if (unlikely(__pyx_t_1 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 3733, __pyx_L1_error)
__pyx_t_3 = PyFloat_FromDouble(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3733, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__pyx_r = __pyx_t_3;
__pyx_t_3 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_3);
__Pyx_AddTraceback("pysndlib.clm.comb", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_379comb, 0, __pyx_n_s_comb, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__461)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 3733, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
__Pyx_CyFunction_SetDefaultsTuple(__pyx_t_40, __pyx_tuple__90);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_comb, __pyx_t_40) < 0) __PYX_ERR(0, 3733, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
/* … */
__pyx_codeobj__461 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__448, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_comb, 3733, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__461)) __PYX_ERR(0, 3733, __pyx_L1_error)
3734: """
3735: comb filter val, pm changes the delay length.
3736:
3737: :param gen: comb gen
3738: :param insig: input value
3739: :param pm: change \in delay length size. can be + or -
3740: :rtype: float
3741: """
+3742: if pm:
__pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_pm); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 3742, __pyx_L1_error) if (__pyx_t_1) { /* … */ }
+3743: return cclm.mus_comb(gen._ptr, insig, pm)
__pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_v_pm); if (unlikely((__pyx_t_2 == ((mus_float_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 3743, __pyx_L1_error) __pyx_r = mus_comb(__pyx_v_gen->_ptr, __pyx_v_insig, __pyx_t_2); goto __pyx_L0;
3744: else:
+3745: return cclm.mus_comb_unmodulated(gen._ptr, insig)
/*else*/ {
__pyx_r = mus_comb_unmodulated(__pyx_v_gen->_ptr, __pyx_v_insig);
goto __pyx_L0;
}
3746:
+3747: cpdef bint is_comb(mus_any gen):
static PyObject *__pyx_pw_8pysndlib_3clm_381is_comb(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static int __pyx_f_8pysndlib_3clm_is_comb(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, CYTHON_UNUSED int __pyx_skip_dispatch) {
int __pyx_r;
/* … */
/* function exit code */
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_381is_comb(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_380is_comb, "\n returns True if gen is a comb.\n \n :param gen: gen\n :rtype: bool\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_381is_comb = {"is_comb", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_381is_comb, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_380is_comb};
static PyObject *__pyx_pw_8pysndlib_3clm_381is_comb(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("is_comb (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gen,0};
PyObject* values[1] = {0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_gen)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3747, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "is_comb") < 0)) __PYX_ERR(0, 3747, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 1)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
}
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)values[0]);
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("is_comb", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 3747, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.is_comb", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gen), __pyx_ptype_8pysndlib_3clm_mus_any, 1, "gen", 0))) __PYX_ERR(0, 3747, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_380is_comb(__pyx_self, __pyx_v_gen);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_380is_comb(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8pysndlib_3clm_is_comb(__pyx_v_gen, 0); if (unlikely(__pyx_t_1 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3747, __pyx_L1_error)
__pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3747, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("pysndlib.clm.is_comb", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_381is_comb, 0, __pyx_n_s_is_comb, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__462)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 3747, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_is_comb, __pyx_t_40) < 0) __PYX_ERR(0, 3747, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
/* … */
__pyx_codeobj__462 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__56, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_is_comb, 3747, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__462)) __PYX_ERR(0, 3747, __pyx_L1_error)
3748: """
3749: returns True if gen is a comb.
3750:
3751: :param gen: gen
3752: :rtype: bool
3753: """
+3754: return cclm.mus_is_comb(gen._ptr)
__pyx_r = mus_is_comb(__pyx_v_gen->_ptr); goto __pyx_L0;
3755:
3756: # ---------------- comb-bank ---------------- #
+3757: cpdef mus_any make_comb_bank(list combs):
static PyObject *__pyx_pw_8pysndlib_3clm_383make_comb_bank(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_f_8pysndlib_3clm_make_comb_bank(PyObject *__pyx_v_combs, CYTHON_UNUSED int __pyx_skip_dispatch) {
PyObject *__pyx_v_p = NULL;
struct __pyx_obj_8pysndlib_3clm_mus_any_array *__pyx_v_comb_array = NULL;
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = NULL;
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_r = NULL;
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("pysndlib.clm.make_comb_bank", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XDECREF(__pyx_v_p);
__Pyx_XDECREF((PyObject *)__pyx_v_comb_array);
__Pyx_XDECREF((PyObject *)__pyx_v_gen);
__Pyx_XGIVEREF((PyObject *)__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_383make_comb_bank(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_382make_comb_bank, "\n return a new comb-bank generator.\n \n :param combs: list of comb gens\n :return: comb_bank gen\n :rtype: mus_any\n \n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_383make_comb_bank = {"make_comb_bank", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_383make_comb_bank, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_382make_comb_bank};
static PyObject *__pyx_pw_8pysndlib_3clm_383make_comb_bank(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
PyObject *__pyx_v_combs = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("make_comb_bank (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_combs,0};
PyObject* values[1] = {0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_combs)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3757, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "make_comb_bank") < 0)) __PYX_ERR(0, 3757, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 1)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
}
__pyx_v_combs = ((PyObject*)values[0]);
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("make_comb_bank", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 3757, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.make_comb_bank", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_combs), (&PyList_Type), 1, "combs", 1))) __PYX_ERR(0, 3757, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_382make_comb_bank(__pyx_self, __pyx_v_combs);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_382make_comb_bank(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_combs) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = ((PyObject *)__pyx_f_8pysndlib_3clm_make_comb_bank(__pyx_v_combs, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3757, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("pysndlib.clm.make_comb_bank", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_tuple__463 = PyTuple_Pack(1, __pyx_n_s_combs); if (unlikely(!__pyx_tuple__463)) __PYX_ERR(0, 3757, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__463);
__Pyx_GIVEREF(__pyx_tuple__463);
/* … */
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_383make_comb_bank, 0, __pyx_n_s_make_comb_bank, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__464)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 3757, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_make_comb_bank, __pyx_t_40) < 0) __PYX_ERR(0, 3757, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
__pyx_codeobj__464 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__463, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_make_comb_bank, 3757, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__464)) __PYX_ERR(0, 3757, __pyx_L1_error)
3758: """
3759: return a new comb-bank generator.
3760:
3761: :param combs: list of comb gens
3762: :return: comb_bank gen
3763: :rtype: mus_any
3764:
3765: """
3766:
+3767: p = list(map(is_comb, combs))
__Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_is_comb); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3767, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3767, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_GIVEREF(__pyx_t_1); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1)) __PYX_ERR(0, 3767, __pyx_L1_error); __Pyx_INCREF(__pyx_v_combs); __Pyx_GIVEREF(__pyx_v_combs); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_combs)) __PYX_ERR(0, 3767, __pyx_L1_error); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_map, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3767, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_PySequence_ListKeepNew(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3767, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_p = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0;
+3768: if not all(p):
__pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_all, __pyx_v_p); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3768, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 3768, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_4 = (!__pyx_t_3); if (unlikely(__pyx_t_4)) { /* … */ }
+3769: raise TypeError(f'filter list contains at least one element that is not a formant.')
__pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__42, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3769, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __PYX_ERR(0, 3769, __pyx_L1_error)
3770:
+3771: comb_array = mus_any_array.from_pylist(combs)
__pyx_t_2 = ((PyObject *)__pyx_f_8pysndlib_3clm_13mus_any_array_from_pylist(__pyx_v_combs)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3771, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_v_comb_array = ((struct __pyx_obj_8pysndlib_3clm_mus_any_array *)__pyx_t_2); __pyx_t_2 = 0;
3772:
+3773: gen = mus_any.from_ptr(cclm.mus_make_comb_bank(len(combs), comb_array.data))
if (unlikely(__pyx_v_combs == Py_None)) {
PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
__PYX_ERR(0, 3773, __pyx_L1_error)
}
__pyx_t_5 = __Pyx_PyList_GET_SIZE(__pyx_v_combs); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(0, 3773, __pyx_L1_error)
__pyx_t_2 = ((PyObject *)__pyx_vtabptr_8pysndlib_3clm_mus_any->from_ptr(mus_make_comb_bank(__pyx_t_5, __pyx_v_comb_array->data), NULL)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3773, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_t_2);
__pyx_t_2 = 0;
+3774: gen.cache_extend([comb_array, combs])
__pyx_t_2 = PyList_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3774, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF((PyObject *)__pyx_v_comb_array); __Pyx_GIVEREF((PyObject *)__pyx_v_comb_array); if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_comb_array))) __PYX_ERR(0, 3774, __pyx_L1_error); __Pyx_INCREF(__pyx_v_combs); __Pyx_GIVEREF(__pyx_v_combs); if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 1, __pyx_v_combs)) __PYX_ERR(0, 3774, __pyx_L1_error); __pyx_t_1 = ((struct __pyx_vtabstruct_8pysndlib_3clm_mus_any *)__pyx_v_gen->__pyx_vtab)->cache_extend(__pyx_v_gen, __pyx_t_2, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3774, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+3775: return gen
__Pyx_XDECREF((PyObject *)__pyx_r); __Pyx_INCREF((PyObject *)__pyx_v_gen); __pyx_r = __pyx_v_gen; goto __pyx_L0;
3776:
+3777: cpdef cython.double comb_bank(mus_any gen, cython.double insig):
static PyObject *__pyx_pw_8pysndlib_3clm_385comb_bank(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static double __pyx_f_8pysndlib_3clm_comb_bank(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, double __pyx_v_insig, CYTHON_UNUSED int __pyx_skip_dispatch) {
double __pyx_r;
/* … */
/* function exit code */
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_385comb_bank(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_384comb_bank, "\n sum an array of comb filters.\n \n :param gen: comb_bank gen\n :param inputs: can be a list/array of inputs or a single input\n :rtype: float\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_385comb_bank = {"comb_bank", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_385comb_bank, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_384comb_bank};
static PyObject *__pyx_pw_8pysndlib_3clm_385comb_bank(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = 0;
double __pyx_v_insig;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("comb_bank (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gen,&__pyx_n_s_insig,0};
PyObject* values[2] = {0,0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_gen)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3777, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_insig)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3777, __pyx_L3_error)
else {
__Pyx_RaiseArgtupleInvalid("comb_bank", 1, 2, 2, 1); __PYX_ERR(0, 3777, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "comb_bank") < 0)) __PYX_ERR(0, 3777, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 2)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
}
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)values[0]);
__pyx_v_insig = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_insig == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 3777, __pyx_L3_error)
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("comb_bank", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 3777, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.comb_bank", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gen), __pyx_ptype_8pysndlib_3clm_mus_any, 1, "gen", 0))) __PYX_ERR(0, 3777, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_384comb_bank(__pyx_self, __pyx_v_gen, __pyx_v_insig);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_384comb_bank(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, double __pyx_v_insig) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8pysndlib_3clm_comb_bank(__pyx_v_gen, __pyx_v_insig, 0); if (unlikely(__pyx_t_1 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 3777, __pyx_L1_error)
__pyx_t_2 = PyFloat_FromDouble(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3777, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("pysndlib.clm.comb_bank", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_385comb_bank, 0, __pyx_n_s_comb_bank, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__465)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 3777, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_comb_bank, __pyx_t_40) < 0) __PYX_ERR(0, 3777, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
/* … */
__pyx_codeobj__465 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__380, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_comb_bank, 3777, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__465)) __PYX_ERR(0, 3777, __pyx_L1_error)
3778: """
3779: sum an array of comb filters.
3780:
3781: :param gen: comb_bank gen
3782: :param inputs: can be a list/array of inputs or a single input
3783: :rtype: float
3784: """
+3785: return cclm.mus_comb_bank(gen._ptr, insig)
__pyx_r = mus_comb_bank(__pyx_v_gen->_ptr, __pyx_v_insig); goto __pyx_L0;
3786:
+3787: cpdef bint is_comb_bank(mus_any gen):
static PyObject *__pyx_pw_8pysndlib_3clm_387is_comb_bank(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static int __pyx_f_8pysndlib_3clm_is_comb_bank(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, CYTHON_UNUSED int __pyx_skip_dispatch) {
int __pyx_r;
/* … */
/* function exit code */
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_387is_comb_bank(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_386is_comb_bank, "\n returns True if gen is a comb_bank\n \n :param gen: gen\n :rtype: bool\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_387is_comb_bank = {"is_comb_bank", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_387is_comb_bank, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_386is_comb_bank};
static PyObject *__pyx_pw_8pysndlib_3clm_387is_comb_bank(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("is_comb_bank (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gen,0};
PyObject* values[1] = {0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_gen)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3787, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "is_comb_bank") < 0)) __PYX_ERR(0, 3787, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 1)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
}
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)values[0]);
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("is_comb_bank", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 3787, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.is_comb_bank", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gen), __pyx_ptype_8pysndlib_3clm_mus_any, 1, "gen", 0))) __PYX_ERR(0, 3787, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_386is_comb_bank(__pyx_self, __pyx_v_gen);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_386is_comb_bank(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8pysndlib_3clm_is_comb_bank(__pyx_v_gen, 0); if (unlikely(__pyx_t_1 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3787, __pyx_L1_error)
__pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3787, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("pysndlib.clm.is_comb_bank", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_387is_comb_bank, 0, __pyx_n_s_is_comb_bank, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__466)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 3787, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_is_comb_bank, __pyx_t_40) < 0) __PYX_ERR(0, 3787, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
/* … */
__pyx_codeobj__466 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__56, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_is_comb_bank, 3787, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__466)) __PYX_ERR(0, 3787, __pyx_L1_error)
3788: """
3789: returns True if gen is a comb_bank
3790:
3791: :param gen: gen
3792: :rtype: bool
3793: """
+3794: return cclm.mus_is_comb_bank(gen._ptr)
__pyx_r = mus_is_comb_bank(__pyx_v_gen->_ptr); goto __pyx_L0;
3795:
3796:
3797: # ---------------- filtered-comb ---------------- #
+3798: cpdef mus_any make_filtered_comb(cython.double feedback,cython.long size, mus_any filter, initial_contents=None, cython.double initial_element=0.0, max_size=None, Interp interp_type=Interp.NONE):
static PyObject *__pyx_pw_8pysndlib_3clm_389make_filtered_comb(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_f_8pysndlib_3clm_make_filtered_comb(double __pyx_v_feedback, long __pyx_v_size, struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_filter, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_8pysndlib_3clm_make_filtered_comb *__pyx_optional_args) {
PyObject *__pyx_v_initial_contents = ((PyObject *)Py_None);
double __pyx_v_initial_element = ((double)0.0);
PyObject *__pyx_v_max_size = ((PyObject *)Py_None);
enum __pyx_t_8pysndlib_3clm_Interp __pyx_v_interp_type = __pyx_k__45;
__Pyx_memviewslice __pyx_v_initial_contents_view = { 0, 0, { 0 }, { 0 }, { 0 } };
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = NULL;
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_r = NULL;
if (__pyx_optional_args) {
if (__pyx_optional_args->__pyx_n > 0) {
__pyx_v_initial_contents = __pyx_optional_args->initial_contents;
if (__pyx_optional_args->__pyx_n > 1) {
__pyx_v_initial_element = __pyx_optional_args->initial_element;
if (__pyx_optional_args->__pyx_n > 2) {
__pyx_v_max_size = __pyx_optional_args->max_size;
if (__pyx_optional_args->__pyx_n > 3) {
__pyx_v_interp_type = __pyx_optional_args->interp_type;
}
}
}
}
}
__Pyx_INCREF(__pyx_v_initial_contents);
__Pyx_INCREF(__pyx_v_max_size);
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__PYX_XCLEAR_MEMVIEW(&__pyx_t_4, 1);
__Pyx_XDECREF(__pyx_t_7);
__Pyx_XDECREF(__pyx_t_9);
__Pyx_AddTraceback("pysndlib.clm.make_filtered_comb", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__PYX_XCLEAR_MEMVIEW(&__pyx_v_initial_contents_view, 1);
__Pyx_XDECREF((PyObject *)__pyx_v_gen);
__Pyx_XDECREF(__pyx_v_initial_contents);
__Pyx_XDECREF(__pyx_v_max_size);
__Pyx_XGIVEREF((PyObject *)__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_389make_filtered_comb(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_388make_filtered_comb, "\n return a new filtered comb filter (a delay line with a scaler and a filter on the feedback) of size\n elements. if the comb length will be changing at run-time, max-size sets its maximum length. \n \n :param feedback: scaler on feedback\n :param size: delay length \\in samples\n :param filter: filter to apply \n :param initial_contents: delay line's initial values\n :param initial_element: delay line's initial element\n :param max_size: maximum delay size \\in case the delay changes\n :param type: interpolation type\n :return: filtered_comb gen\n :rtype: mus_any\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_389make_filtered_comb = {"make_filtered_comb", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_389make_filtered_comb, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_388make_filtered_comb};
static PyObject *__pyx_pw_8pysndlib_3clm_389make_filtered_comb(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
double __pyx_v_feedback;
long __pyx_v_size;
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_filter = 0;
PyObject *__pyx_v_initial_contents = 0;
double __pyx_v_initial_element;
PyObject *__pyx_v_max_size = 0;
enum __pyx_t_8pysndlib_3clm_Interp __pyx_v_interp_type;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("make_filtered_comb (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_feedback,&__pyx_n_s_size,&__pyx_n_s_filter,&__pyx_n_s_initial_contents,&__pyx_n_s_initial_element,&__pyx_n_s_max_size,&__pyx_n_s_interp_type,0};
PyObject* values[7] = {0,0,0,0,0,0,0};
values[3] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
values[5] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 7: values[6] = __Pyx_Arg_FASTCALL(__pyx_args, 6);
CYTHON_FALLTHROUGH;
case 6: values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5);
CYTHON_FALLTHROUGH;
case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4);
CYTHON_FALLTHROUGH;
case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
CYTHON_FALLTHROUGH;
case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_feedback)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3798, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_size)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3798, __pyx_L3_error)
else {
__Pyx_RaiseArgtupleInvalid("make_filtered_comb", 0, 3, 7, 1); __PYX_ERR(0, 3798, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 2:
if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_filter)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[2]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3798, __pyx_L3_error)
else {
__Pyx_RaiseArgtupleInvalid("make_filtered_comb", 0, 3, 7, 2); __PYX_ERR(0, 3798, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 3:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_initial_contents);
if (value) { values[3] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3798, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 4:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_initial_element);
if (value) { values[4] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3798, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 5:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_max_size);
if (value) { values[5] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3798, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 6:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_interp_type);
if (value) { values[6] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3798, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "make_filtered_comb") < 0)) __PYX_ERR(0, 3798, __pyx_L3_error)
}
} else {
switch (__pyx_nargs) {
case 7: values[6] = __Pyx_Arg_FASTCALL(__pyx_args, 6);
CYTHON_FALLTHROUGH;
case 6: values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5);
CYTHON_FALLTHROUGH;
case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4);
CYTHON_FALLTHROUGH;
case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
CYTHON_FALLTHROUGH;
case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
break;
default: goto __pyx_L5_argtuple_error;
}
}
__pyx_v_feedback = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_feedback == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 3798, __pyx_L3_error)
__pyx_v_size = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_size == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 3798, __pyx_L3_error)
__pyx_v_filter = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)values[2]);
__pyx_v_initial_contents = values[3];
if (values[4]) {
__pyx_v_initial_element = __pyx_PyFloat_AsDouble(values[4]); if (unlikely((__pyx_v_initial_element == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 3798, __pyx_L3_error)
} else {
__pyx_v_initial_element = ((double)0.0);
}
__pyx_v_max_size = values[5];
if (values[6]) {
__pyx_v_interp_type = ((enum __pyx_t_8pysndlib_3clm_Interp)__Pyx_PyInt_As_enum____pyx_t_8pysndlib_3clm_Interp(values[6])); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3798, __pyx_L3_error)
} else {
__pyx_v_interp_type = __pyx_k__45;
}
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("make_filtered_comb", 0, 3, 7, __pyx_nargs); __PYX_ERR(0, 3798, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.make_filtered_comb", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_filter), __pyx_ptype_8pysndlib_3clm_mus_any, 1, "filter", 0))) __PYX_ERR(0, 3798, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_388make_filtered_comb(__pyx_self, __pyx_v_feedback, __pyx_v_size, __pyx_v_filter, __pyx_v_initial_contents, __pyx_v_initial_element, __pyx_v_max_size, __pyx_v_interp_type);
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_388make_filtered_comb(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_feedback, long __pyx_v_size, struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_filter, PyObject *__pyx_v_initial_contents, double __pyx_v_initial_element, PyObject *__pyx_v_max_size, enum __pyx_t_8pysndlib_3clm_Interp __pyx_v_interp_type) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_2.__pyx_n = 4;
__pyx_t_2.initial_contents = __pyx_v_initial_contents;
__pyx_t_2.initial_element = __pyx_v_initial_element;
__pyx_t_2.max_size = __pyx_v_max_size;
__pyx_t_2.interp_type = __pyx_v_interp_type;
__pyx_t_1 = ((PyObject *)__pyx_f_8pysndlib_3clm_make_filtered_comb(__pyx_v_feedback, __pyx_v_size, __pyx_v_filter, 0, &__pyx_t_2)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3798, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("pysndlib.clm.make_filtered_comb", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_k__45 = __pyx_e_8pysndlib_3clm_NONE;
/* … */
__pyx_tuple__467 = PyTuple_Pack(7, __pyx_n_s_feedback, __pyx_n_s_size, __pyx_n_s_filter, __pyx_n_s_initial_contents, __pyx_n_s_initial_element, __pyx_n_s_max_size, __pyx_n_s_interp_type); if (unlikely(!__pyx_tuple__467)) __PYX_ERR(0, 3798, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__467);
__Pyx_GIVEREF(__pyx_tuple__467);
__pyx_t_40 = __Pyx_Enum_Interp_to_py(__pyx_e_8pysndlib_3clm_NONE); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 3798, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
__pyx_t_43 = PyTuple_New(4); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 3798, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
__Pyx_INCREF(Py_None);
__Pyx_GIVEREF(Py_None);
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_43, 0, Py_None)) __PYX_ERR(0, 3798, __pyx_L1_error);
__Pyx_INCREF(__pyx_float_0_0);
__Pyx_GIVEREF(__pyx_float_0_0);
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_43, 1, __pyx_float_0_0)) __PYX_ERR(0, 3798, __pyx_L1_error);
__Pyx_INCREF(Py_None);
__Pyx_GIVEREF(Py_None);
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_43, 2, Py_None)) __PYX_ERR(0, 3798, __pyx_L1_error);
__Pyx_GIVEREF(__pyx_t_40);
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_43, 3, __pyx_t_40)) __PYX_ERR(0, 3798, __pyx_L1_error);
__pyx_t_40 = 0;
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_389make_filtered_comb, 0, __pyx_n_s_make_filtered_comb, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__468)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 3798, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
__Pyx_CyFunction_SetDefaultsTuple(__pyx_t_40, __pyx_t_43);
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
if (PyDict_SetItem(__pyx_d, __pyx_n_s_make_filtered_comb, __pyx_t_40) < 0) __PYX_ERR(0, 3798, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
__pyx_codeobj__468 = (PyObject*)__Pyx_PyCode_New(7, 0, 0, 7, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__467, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_make_filtered_comb, 3798, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__468)) __PYX_ERR(0, 3798, __pyx_L1_error)
/* … */
struct __pyx_opt_args_8pysndlib_3clm_make_filtered_comb {
int __pyx_n;
PyObject *initial_contents;
double initial_element;
PyObject *max_size;
enum __pyx_t_8pysndlib_3clm_Interp interp_type;
};
3799:
3800: """
3801: return a new filtered comb filter (a delay line with a scaler and a filter on the feedback) of size
3802: elements. if the comb length will be changing at run-time, max-size sets its maximum length.
3803:
3804: :param feedback: scaler on feedback
3805: :param size: delay length \in samples
3806: :param filter: filter to apply
3807: :param initial_contents: delay line's initial values
3808: :param initial_element: delay line's initial element
3809: :param max_size: maximum delay size \in case the delay changes
3810: :param type: interpolation type
3811: :return: filtered_comb gen
3812: :rtype: mus_any
3813: """
+3814: check_range('size', size, 0.0, None)
__pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3814, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_3.__pyx_n = 2; __pyx_t_3.low = __pyx_float_0_0; __pyx_t_3.high = Py_None; __pyx_t_2 = __pyx_f_8pysndlib_3clm_check_range(__pyx_n_s_size, __pyx_t_1, 0, &__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3814, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3815:
+3816: cdef double [:] initial_contents_view = None
__pyx_t_4 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(Py_None, PyBUF_WRITABLE); if (unlikely(!__pyx_t_4.memview)) __PYX_ERR(0, 3816, __pyx_L1_error) __pyx_v_initial_contents_view = __pyx_t_4; __pyx_t_4.memview = NULL; __pyx_t_4.data = NULL;
3817:
+3818: if not max_size:
__pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_max_size); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 3818, __pyx_L1_error) __pyx_t_6 = (!__pyx_t_5); if (__pyx_t_6) { /* … */ }
+3819: max_size = size
__pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v_size); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3819, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF_SET(__pyx_v_max_size, __pyx_t_2); __pyx_t_2 = 0;
3820:
+3821: if max_size != size and interp_type == Interp.NONE:
__pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v_size); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3821, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_1 = PyObject_RichCompare(__pyx_v_max_size, __pyx_t_2, Py_NE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3821, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 3821, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_5) { } else { __pyx_t_6 = __pyx_t_5; goto __pyx_L5_bool_binop_done; } __pyx_t_5 = (__pyx_v_interp_type == __pyx_e_8pysndlib_3clm_NONE); __pyx_t_6 = __pyx_t_5; __pyx_L5_bool_binop_done:; if (__pyx_t_6) { /* … */ }
+3822: interp_type = Interp.BEZIER #think this is correct from clm2xen.c
__pyx_v_interp_type = __pyx_e_8pysndlib_3clm_BEZIER;
3823:
+3824: if initial_contents is not None:
__pyx_t_6 = (__pyx_v_initial_contents != Py_None);
if (__pyx_t_6) {
/* … */
goto __pyx_L7;
}
+3825: if isinstance(initial_contents, list):
__pyx_t_6 = PyList_Check(__pyx_v_initial_contents);
if (__pyx_t_6) {
/* … */
}
+3826: initial_contents = np.array(initial_contents)
__Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3826, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_array); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3826, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = NULL; __pyx_t_8 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_7))) { __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_7); if (likely(__pyx_t_2)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7); __Pyx_INCREF(__pyx_t_2); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_7, function); __pyx_t_8 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_v_initial_contents}; __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_7, __pyx_callargs+1-__pyx_t_8, 1+__pyx_t_8); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3826, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; } __Pyx_DECREF_SET(__pyx_v_initial_contents, __pyx_t_1); __pyx_t_1 = 0;
+3827: initial_contents_view = initial_contents
__pyx_t_4 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_v_initial_contents, PyBUF_WRITABLE); if (unlikely(!__pyx_t_4.memview)) __PYX_ERR(0, 3827, __pyx_L1_error) __PYX_XCLEAR_MEMVIEW(&__pyx_v_initial_contents_view, 1); __pyx_v_initial_contents_view = __pyx_t_4; __pyx_t_4.memview = NULL; __pyx_t_4.data = NULL;
3828:
+3829: elif initial_element:
__pyx_t_6 = (__pyx_v_initial_element != 0);
if (__pyx_t_6) {
/* … */
}
__pyx_L7:;
+3830: initial_contents = np.zeros(max_size)
__Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3830, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_zeros); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3830, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_7 = NULL; __pyx_t_8 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_2))) { __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_7)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_7); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); __pyx_t_8 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_v_max_size}; __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_8, 1+__pyx_t_8); __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3830, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } __Pyx_DECREF_SET(__pyx_v_initial_contents, __pyx_t_1); __pyx_t_1 = 0;
+3831: check_ndim(initial_contents)
__pyx_t_1 = __pyx_f_8pysndlib_3clm_check_ndim(__pyx_v_initial_contents, 0, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3831, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+3832: initial_contents.fill(initial_element)
__pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_initial_contents, __pyx_n_s_fill); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3832, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_7 = PyFloat_FromDouble(__pyx_v_initial_element); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3832, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_9 = NULL; __pyx_t_8 = 0; #if CYTHON_UNPACK_METHODS if (likely(PyMethod_Check(__pyx_t_2))) { __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_9)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_9); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); __pyx_t_8 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_9, __pyx_t_7}; __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_8, 1+__pyx_t_8); __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3832, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+3833: initial_contents_view = initial_contents
__pyx_t_4 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_v_initial_contents, PyBUF_WRITABLE); if (unlikely(!__pyx_t_4.memview)) __PYX_ERR(0, 3833, __pyx_L1_error) __PYX_XCLEAR_MEMVIEW(&__pyx_v_initial_contents_view, 1); __pyx_v_initial_contents_view = __pyx_t_4; __pyx_t_4.memview = NULL; __pyx_t_4.data = NULL;
3834:
+3835: if initial_contents_view is not None:
__pyx_t_6 = (((PyObject *) __pyx_v_initial_contents_view.memview) != Py_None);
if (__pyx_t_6) {
/* … */
goto __pyx_L9;
}
+3836: gen = mus_any.from_ptr(cclm.mus_make_filtered_comb(feedback, int(size), &initial_contents_view[0], int(max_size), <cclm.mus_interp_t>interp_type, filter._ptr))
__pyx_t_10 = 0;
__pyx_t_8 = -1;
if (__pyx_t_10 < 0) {
__pyx_t_10 += __pyx_v_initial_contents_view.shape[0];
if (unlikely(__pyx_t_10 < 0)) __pyx_t_8 = 0;
} else if (unlikely(__pyx_t_10 >= __pyx_v_initial_contents_view.shape[0])) __pyx_t_8 = 0;
if (unlikely(__pyx_t_8 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_8);
__PYX_ERR(0, 3836, __pyx_L1_error)
}
__pyx_t_1 = __Pyx_PyNumber_Int(__pyx_v_max_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3836, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_8 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3836, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_t_1 = ((PyObject *)__pyx_vtabptr_8pysndlib_3clm_mus_any->from_ptr(mus_make_filtered_comb(__pyx_v_feedback, ((int)__pyx_v_size), (&(*((double *) ( /* dim=0 */ (__pyx_v_initial_contents_view.data + __pyx_t_10 * __pyx_v_initial_contents_view.strides[0]) )))), __pyx_t_8, ((mus_interp_t)__pyx_v_interp_type), __pyx_v_filter->_ptr), NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3836, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_t_1);
__pyx_t_1 = 0;
3837: else:
+3838: gen = mus_any.from_ptr(cclm.mus_make_filtered_comb(feedback, int(size), NULL, int(max_size), <cclm.mus_interp_t>interp_type, filter._ptr))
/*else*/ {
__pyx_t_1 = __Pyx_PyNumber_Int(__pyx_v_max_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3838, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_8 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3838, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_t_1 = ((PyObject *)__pyx_vtabptr_8pysndlib_3clm_mus_any->from_ptr(mus_make_filtered_comb(__pyx_v_feedback, ((int)__pyx_v_size), NULL, __pyx_t_8, ((mus_interp_t)__pyx_v_interp_type), __pyx_v_filter->_ptr), NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3838, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_t_1);
__pyx_t_1 = 0;
}
__pyx_L9:;
+3839: gen.cache_append(initial_contents)
__pyx_t_1 = ((struct __pyx_vtabstruct_8pysndlib_3clm_mus_any *)__pyx_v_gen->__pyx_vtab)->cache_append(__pyx_v_gen, __pyx_v_initial_contents, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3839, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+3840: return gen
__Pyx_XDECREF((PyObject *)__pyx_r); __Pyx_INCREF((PyObject *)__pyx_v_gen); __pyx_r = __pyx_v_gen; goto __pyx_L0;
3841:
+3842: cpdef cython.double filtered_comb(mus_any gen, cython.double insig, cython.double pm=0.0):
static PyObject *__pyx_pw_8pysndlib_3clm_391filtered_comb(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static double __pyx_f_8pysndlib_3clm_filtered_comb(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, double __pyx_v_insig, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_8pysndlib_3clm_filtered_comb *__pyx_optional_args) {
double __pyx_v_pm = ((double)0.0);
double __pyx_r;
if (__pyx_optional_args) {
if (__pyx_optional_args->__pyx_n > 0) {
__pyx_v_pm = __pyx_optional_args->pm;
}
}
/* … */
/* function exit code */
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_391filtered_comb(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_390filtered_comb, "\n filtered comb filter val, pm changes the delay length.\n \n :param gen: filtered_comb gen\n :param insig: input value\n :param pm: change \\in delay length size. can be + or -\n :rtype: float\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_391filtered_comb = {"filtered_comb", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_391filtered_comb, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_390filtered_comb};
static PyObject *__pyx_pw_8pysndlib_3clm_391filtered_comb(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = 0;
double __pyx_v_insig;
double __pyx_v_pm;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("filtered_comb (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gen,&__pyx_n_s_insig,&__pyx_n_s_pm,0};
PyObject* values[3] = {0,0,0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_gen)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3842, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_insig)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3842, __pyx_L3_error)
else {
__Pyx_RaiseArgtupleInvalid("filtered_comb", 0, 2, 3, 1); __PYX_ERR(0, 3842, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 2:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pm);
if (value) { values[2] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3842, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "filtered_comb") < 0)) __PYX_ERR(0, 3842, __pyx_L3_error)
}
} else {
switch (__pyx_nargs) {
case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
break;
default: goto __pyx_L5_argtuple_error;
}
}
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)values[0]);
__pyx_v_insig = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_insig == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 3842, __pyx_L3_error)
if (values[2]) {
__pyx_v_pm = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_pm == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 3842, __pyx_L3_error)
} else {
__pyx_v_pm = ((double)0.0);
}
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("filtered_comb", 0, 2, 3, __pyx_nargs); __PYX_ERR(0, 3842, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.filtered_comb", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gen), __pyx_ptype_8pysndlib_3clm_mus_any, 1, "gen", 0))) __PYX_ERR(0, 3842, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_390filtered_comb(__pyx_self, __pyx_v_gen, __pyx_v_insig, __pyx_v_pm);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_390filtered_comb(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, double __pyx_v_insig, double __pyx_v_pm) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_2.__pyx_n = 1;
__pyx_t_2.pm = __pyx_v_pm;
__pyx_t_1 = __pyx_f_8pysndlib_3clm_filtered_comb(__pyx_v_gen, __pyx_v_insig, 0, &__pyx_t_2); if (unlikely(__pyx_t_1 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 3842, __pyx_L1_error)
__pyx_t_3 = PyFloat_FromDouble(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3842, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__pyx_r = __pyx_t_3;
__pyx_t_3 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_3);
__Pyx_AddTraceback("pysndlib.clm.filtered_comb", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_codeobj__469 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__448, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_filtered_comb, 3842, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__469)) __PYX_ERR(0, 3842, __pyx_L1_error)
/* … */
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_391filtered_comb, 0, __pyx_n_s_filtered_comb, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__469)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 3842, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
__Pyx_CyFunction_SetDefaultsTuple(__pyx_t_40, __pyx_tuple__470);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_filtered_comb, __pyx_t_40) < 0) __PYX_ERR(0, 3842, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
__pyx_tuple__470 = PyTuple_Pack(1, __pyx_float_0_0); if (unlikely(!__pyx_tuple__470)) __PYX_ERR(0, 3842, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__470);
__Pyx_GIVEREF(__pyx_tuple__470);
3843: """
3844: filtered comb filter val, pm changes the delay length.
3845:
3846: :param gen: filtered_comb gen
3847: :param insig: input value
3848: :param pm: change \in delay length size. can be + or -
3849: :rtype: float
3850: """
+3851: return cclm.mus_filtered_comb(gen._ptr, insig, pm)
__pyx_r = mus_filtered_comb(__pyx_v_gen->_ptr, __pyx_v_insig, __pyx_v_pm); goto __pyx_L0;
3852:
3853:
+3854: cpdef cython.double filtered_comb_unmodulated(mus_any gen, cython.double insig):
static PyObject *__pyx_pw_8pysndlib_3clm_393filtered_comb_unmodulated(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static double __pyx_f_8pysndlib_3clm_filtered_comb_unmodulated(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, double __pyx_v_insig, CYTHON_UNUSED int __pyx_skip_dispatch) {
double __pyx_r;
/* … */
/* function exit code */
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_393filtered_comb_unmodulated(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_392filtered_comb_unmodulated, "\n filtered comb filter val, pm changes the delay length. unmodulated\n \n :param gen: filtered_comb gen\n :param insig: input value\n :param pm: change \\in delay length size. can be + or -\n :rtype: float\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_393filtered_comb_unmodulated = {"filtered_comb_unmodulated", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_393filtered_comb_unmodulated, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_392filtered_comb_unmodulated};
static PyObject *__pyx_pw_8pysndlib_3clm_393filtered_comb_unmodulated(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = 0;
double __pyx_v_insig;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("filtered_comb_unmodulated (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gen,&__pyx_n_s_insig,0};
PyObject* values[2] = {0,0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_gen)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3854, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_insig)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3854, __pyx_L3_error)
else {
__Pyx_RaiseArgtupleInvalid("filtered_comb_unmodulated", 1, 2, 2, 1); __PYX_ERR(0, 3854, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "filtered_comb_unmodulated") < 0)) __PYX_ERR(0, 3854, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 2)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
}
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)values[0]);
__pyx_v_insig = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_insig == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 3854, __pyx_L3_error)
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("filtered_comb_unmodulated", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 3854, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.filtered_comb_unmodulated", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gen), __pyx_ptype_8pysndlib_3clm_mus_any, 1, "gen", 0))) __PYX_ERR(0, 3854, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_392filtered_comb_unmodulated(__pyx_self, __pyx_v_gen, __pyx_v_insig);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_392filtered_comb_unmodulated(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, double __pyx_v_insig) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8pysndlib_3clm_filtered_comb_unmodulated(__pyx_v_gen, __pyx_v_insig, 0); if (unlikely(__pyx_t_1 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 3854, __pyx_L1_error)
__pyx_t_2 = PyFloat_FromDouble(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3854, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("pysndlib.clm.filtered_comb_unmodulated", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_393filtered_comb_unmodulated, 0, __pyx_n_s_filtered_comb_unmodulated, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__471)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 3854, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_filtered_comb_unmodulated, __pyx_t_40) < 0) __PYX_ERR(0, 3854, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
/* … */
__pyx_codeobj__471 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__380, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_filtered_comb_unmodulated, 3854, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__471)) __PYX_ERR(0, 3854, __pyx_L1_error)
3855: """
3856: filtered comb filter val, pm changes the delay length. unmodulated
3857:
3858: :param gen: filtered_comb gen
3859: :param insig: input value
3860: :param pm: change \in delay length size. can be + or -
3861: :rtype: float
3862: """
+3863: return cclm.mus_filtered_comb_unmodulated(gen._ptr, insig)
__pyx_r = mus_filtered_comb_unmodulated(__pyx_v_gen->_ptr, __pyx_v_insig); goto __pyx_L0;
3864:
+3865: cpdef bint is_filtered_comb(mus_any gen):
static PyObject *__pyx_pw_8pysndlib_3clm_395is_filtered_comb(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static int __pyx_f_8pysndlib_3clm_is_filtered_comb(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, CYTHON_UNUSED int __pyx_skip_dispatch) {
int __pyx_r;
/* … */
/* function exit code */
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_395is_filtered_comb(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_394is_filtered_comb, "\n returns True if gen is a filtered_comb.\n \n :param gen: gen\n :rtype: bool\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_395is_filtered_comb = {"is_filtered_comb", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_395is_filtered_comb, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_394is_filtered_comb};
static PyObject *__pyx_pw_8pysndlib_3clm_395is_filtered_comb(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("is_filtered_comb (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gen,0};
PyObject* values[1] = {0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_gen)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3865, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "is_filtered_comb") < 0)) __PYX_ERR(0, 3865, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 1)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
}
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)values[0]);
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("is_filtered_comb", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 3865, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.is_filtered_comb", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gen), __pyx_ptype_8pysndlib_3clm_mus_any, 1, "gen", 0))) __PYX_ERR(0, 3865, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_394is_filtered_comb(__pyx_self, __pyx_v_gen);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_394is_filtered_comb(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8pysndlib_3clm_is_filtered_comb(__pyx_v_gen, 0); if (unlikely(__pyx_t_1 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3865, __pyx_L1_error)
__pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3865, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("pysndlib.clm.is_filtered_comb", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_395is_filtered_comb, 0, __pyx_n_s_is_filtered_comb, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__472)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 3865, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_is_filtered_comb, __pyx_t_40) < 0) __PYX_ERR(0, 3865, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
/* … */
__pyx_codeobj__472 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__56, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_is_filtered_comb, 3865, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__472)) __PYX_ERR(0, 3865, __pyx_L1_error)
3866: """
3867: returns True if gen is a filtered_comb.
3868:
3869: :param gen: gen
3870: :rtype: bool
3871: """
+3872: return cclm.mus_is_filtered_comb(gen._ptr)
__pyx_r = mus_is_filtered_comb(__pyx_v_gen->_ptr); goto __pyx_L0;
3873:
3874: # ---------------- filtered-comb-bank ---------------- #
+3875: cpdef mus_any make_filtered_comb_bank(list fcombs):
static PyObject *__pyx_pw_8pysndlib_3clm_397make_filtered_comb_bank(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_f_8pysndlib_3clm_make_filtered_comb_bank(PyObject *__pyx_v_fcombs, CYTHON_UNUSED int __pyx_skip_dispatch) {
PyObject *__pyx_v_p = NULL;
struct __pyx_obj_8pysndlib_3clm_mus_any_array *__pyx_v_fcomb_array = NULL;
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = NULL;
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_r = NULL;
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("pysndlib.clm.make_filtered_comb_bank", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XDECREF(__pyx_v_p);
__Pyx_XDECREF((PyObject *)__pyx_v_fcomb_array);
__Pyx_XDECREF((PyObject *)__pyx_v_gen);
__Pyx_XGIVEREF((PyObject *)__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_397make_filtered_comb_bank(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_396make_filtered_comb_bank, "\n return a new filtered_comb-bank generator.\n \n :param fcombs: list of filtered_comb gens\n :return: filtered_comb_bank gen\n :rtype: mus_any\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_397make_filtered_comb_bank = {"make_filtered_comb_bank", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_397make_filtered_comb_bank, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_396make_filtered_comb_bank};
static PyObject *__pyx_pw_8pysndlib_3clm_397make_filtered_comb_bank(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
PyObject *__pyx_v_fcombs = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("make_filtered_comb_bank (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_fcombs,0};
PyObject* values[1] = {0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_fcombs)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3875, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "make_filtered_comb_bank") < 0)) __PYX_ERR(0, 3875, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 1)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
}
__pyx_v_fcombs = ((PyObject*)values[0]);
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("make_filtered_comb_bank", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 3875, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.make_filtered_comb_bank", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_fcombs), (&PyList_Type), 1, "fcombs", 1))) __PYX_ERR(0, 3875, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_396make_filtered_comb_bank(__pyx_self, __pyx_v_fcombs);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_396make_filtered_comb_bank(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_fcombs) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = ((PyObject *)__pyx_f_8pysndlib_3clm_make_filtered_comb_bank(__pyx_v_fcombs, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3875, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("pysndlib.clm.make_filtered_comb_bank", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_tuple__473 = PyTuple_Pack(1, __pyx_n_s_fcombs); if (unlikely(!__pyx_tuple__473)) __PYX_ERR(0, 3875, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__473);
__Pyx_GIVEREF(__pyx_tuple__473);
/* … */
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_397make_filtered_comb_bank, 0, __pyx_n_s_make_filtered_comb_bank, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__474)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 3875, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_make_filtered_comb_bank, __pyx_t_40) < 0) __PYX_ERR(0, 3875, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
__pyx_codeobj__474 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__473, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_make_filtered_comb_bank, 3875, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__474)) __PYX_ERR(0, 3875, __pyx_L1_error)
3876: """
3877: return a new filtered_comb-bank generator.
3878:
3879: :param fcombs: list of filtered_comb gens
3880: :return: filtered_comb_bank gen
3881: :rtype: mus_any
3882: """
+3883: p = list(map(is_formant, fcombs))
__Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_is_formant); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3883, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3883, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_GIVEREF(__pyx_t_1); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1)) __PYX_ERR(0, 3883, __pyx_L1_error); __Pyx_INCREF(__pyx_v_fcombs); __Pyx_GIVEREF(__pyx_v_fcombs); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_fcombs)) __PYX_ERR(0, 3883, __pyx_L1_error); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_map, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3883, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_PySequence_ListKeepNew(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3883, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_p = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0;
+3884: if not all(p):
__pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_all, __pyx_v_p); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3884, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 3884, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_4 = (!__pyx_t_3); if (unlikely(__pyx_t_4)) { /* … */ }
+3885: raise TypeError(f'filter list contains at least one element that is not a filtered_comb.')
__pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__46, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3885, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __PYX_ERR(0, 3885, __pyx_L1_error) /* … */ __pyx_tuple__46 = PyTuple_Pack(1, __pyx_kp_u_filter_list_contains_at_least_on_2); if (unlikely(!__pyx_tuple__46)) __PYX_ERR(0, 3885, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__46); __Pyx_GIVEREF(__pyx_tuple__46);
3886:
+3887: fcomb_array = mus_any_array.from_pylist(fcombs)
__pyx_t_2 = ((PyObject *)__pyx_f_8pysndlib_3clm_13mus_any_array_from_pylist(__pyx_v_fcombs)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3887, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_v_fcomb_array = ((struct __pyx_obj_8pysndlib_3clm_mus_any_array *)__pyx_t_2); __pyx_t_2 = 0;
3888:
+3889: gen = mus_any.from_ptr(cclm.mus_make_filtered_comb_bank(len(fcombs), fcomb_array.data))
if (unlikely(__pyx_v_fcombs == Py_None)) {
PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
__PYX_ERR(0, 3889, __pyx_L1_error)
}
__pyx_t_5 = __Pyx_PyList_GET_SIZE(__pyx_v_fcombs); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(0, 3889, __pyx_L1_error)
__pyx_t_2 = ((PyObject *)__pyx_vtabptr_8pysndlib_3clm_mus_any->from_ptr(mus_make_filtered_comb_bank(__pyx_t_5, __pyx_v_fcomb_array->data), NULL)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3889, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_t_2);
__pyx_t_2 = 0;
+3890: gen.cache_extend([fcomb_array, fcombs])
__pyx_t_2 = PyList_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3890, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF((PyObject *)__pyx_v_fcomb_array); __Pyx_GIVEREF((PyObject *)__pyx_v_fcomb_array); if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_fcomb_array))) __PYX_ERR(0, 3890, __pyx_L1_error); __Pyx_INCREF(__pyx_v_fcombs); __Pyx_GIVEREF(__pyx_v_fcombs); if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 1, __pyx_v_fcombs)) __PYX_ERR(0, 3890, __pyx_L1_error); __pyx_t_1 = ((struct __pyx_vtabstruct_8pysndlib_3clm_mus_any *)__pyx_v_gen->__pyx_vtab)->cache_extend(__pyx_v_gen, __pyx_t_2, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3890, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+3891: return gen
__Pyx_XDECREF((PyObject *)__pyx_r); __Pyx_INCREF((PyObject *)__pyx_v_gen); __pyx_r = __pyx_v_gen; goto __pyx_L0;
3892:
+3893: cpdef cython.double filtered_comb_bank(mus_any gen):
static PyObject *__pyx_pw_8pysndlib_3clm_399filtered_comb_bank(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static double __pyx_f_8pysndlib_3clm_filtered_comb_bank(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, CYTHON_UNUSED int __pyx_skip_dispatch) {
double __pyx_r;
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_AddTraceback("pysndlib.clm.filtered_comb_bank", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = -1;
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_399filtered_comb_bank(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_398filtered_comb_bank, "\n sum an array of filtered_comb filters.\n \n :param gen: filtered_comb gen\n :param inputs: can be a list/array of inputs or a single input\n :rtype: float\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_399filtered_comb_bank = {"filtered_comb_bank", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_399filtered_comb_bank, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_398filtered_comb_bank};
static PyObject *__pyx_pw_8pysndlib_3clm_399filtered_comb_bank(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("filtered_comb_bank (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gen,0};
PyObject* values[1] = {0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_gen)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3893, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "filtered_comb_bank") < 0)) __PYX_ERR(0, 3893, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 1)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
}
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)values[0]);
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("filtered_comb_bank", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 3893, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.filtered_comb_bank", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gen), __pyx_ptype_8pysndlib_3clm_mus_any, 1, "gen", 0))) __PYX_ERR(0, 3893, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_398filtered_comb_bank(__pyx_self, __pyx_v_gen);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_398filtered_comb_bank(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8pysndlib_3clm_filtered_comb_bank(__pyx_v_gen, 0); if (unlikely(__pyx_t_1 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 3893, __pyx_L1_error)
__pyx_t_2 = PyFloat_FromDouble(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3893, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("pysndlib.clm.filtered_comb_bank", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_399filtered_comb_bank, 0, __pyx_n_s_filtered_comb_bank, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__475)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 3893, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_filtered_comb_bank, __pyx_t_40) < 0) __PYX_ERR(0, 3893, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
/* … */
__pyx_codeobj__475 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__56, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_filtered_comb_bank, 3893, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__475)) __PYX_ERR(0, 3893, __pyx_L1_error)
3894: """
3895: sum an array of filtered_comb filters.
3896:
3897: :param gen: filtered_comb gen
3898: :param inputs: can be a list/array of inputs or a single input
3899: :rtype: float
3900: """
+3901: return cclm.mus_filtered_comb_bank(gen._ptr, input)
__pyx_t_1 = __pyx_PyFloat_AsDouble(__pyx_builtin_input); if (unlikely((__pyx_t_1 == ((mus_float_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 3901, __pyx_L1_error) __pyx_r = mus_filtered_comb_bank(__pyx_v_gen->_ptr, __pyx_t_1); goto __pyx_L0;
3902:
+3903: cpdef bint is_filtered_comb_bank(mus_any gen):
static PyObject *__pyx_pw_8pysndlib_3clm_401is_filtered_comb_bank(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static int __pyx_f_8pysndlib_3clm_is_filtered_comb_bank(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, CYTHON_UNUSED int __pyx_skip_dispatch) {
int __pyx_r;
/* … */
/* function exit code */
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_401is_filtered_comb_bank(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_400is_filtered_comb_bank, "\n returns True if gen is a filtered_comb_bank.\n \n :param gen: gen\n :rtype: bool\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_401is_filtered_comb_bank = {"is_filtered_comb_bank", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_401is_filtered_comb_bank, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_400is_filtered_comb_bank};
static PyObject *__pyx_pw_8pysndlib_3clm_401is_filtered_comb_bank(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("is_filtered_comb_bank (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gen,0};
PyObject* values[1] = {0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_gen)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3903, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "is_filtered_comb_bank") < 0)) __PYX_ERR(0, 3903, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 1)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
}
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)values[0]);
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("is_filtered_comb_bank", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 3903, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.is_filtered_comb_bank", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gen), __pyx_ptype_8pysndlib_3clm_mus_any, 1, "gen", 0))) __PYX_ERR(0, 3903, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_400is_filtered_comb_bank(__pyx_self, __pyx_v_gen);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_400is_filtered_comb_bank(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8pysndlib_3clm_is_filtered_comb_bank(__pyx_v_gen, 0); if (unlikely(__pyx_t_1 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3903, __pyx_L1_error)
__pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3903, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("pysndlib.clm.is_filtered_comb_bank", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_401is_filtered_comb_bank, 0, __pyx_n_s_is_filtered_comb_bank, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__476)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 3903, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_is_filtered_comb_bank, __pyx_t_40) < 0) __PYX_ERR(0, 3903, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
/* … */
__pyx_codeobj__476 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__56, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_is_filtered_comb_bank, 3903, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__476)) __PYX_ERR(0, 3903, __pyx_L1_error)
3904: """
3905: returns True if gen is a filtered_comb_bank.
3906:
3907: :param gen: gen
3908: :rtype: bool
3909: """
+3910: return cclm.mus_is_filtered_comb_bank(gen._ptr)
__pyx_r = mus_is_filtered_comb_bank(__pyx_v_gen->_ptr); goto __pyx_L0;
3911:
3912: # ---------------- notch ---------------- #
+3913: cpdef mus_any make_notch(cython.double feedforward=1.0,size=None,
static PyObject *__pyx_pw_8pysndlib_3clm_403make_notch(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_f_8pysndlib_3clm_make_notch(CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_8pysndlib_3clm_make_notch *__pyx_optional_args) {
double __pyx_v_feedforward = ((double)1.0);
PyObject *__pyx_v_size = ((PyObject *)Py_None);
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__PYX_XCLEAR_MEMVIEW(&__pyx_t_3, 1);
__Pyx_XDECREF(__pyx_t_6);
__Pyx_XDECREF(__pyx_t_7);
__Pyx_XDECREF(__pyx_t_9);
__Pyx_XDECREF(__pyx_t_10);
__Pyx_AddTraceback("pysndlib.clm.make_notch", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__PYX_XCLEAR_MEMVIEW(&__pyx_v_initial_contents_view, 1);
__Pyx_XDECREF((PyObject *)__pyx_v_gen);
__Pyx_XDECREF(__pyx_v_initial_contents);
__Pyx_XDECREF(__pyx_v_max_size);
__Pyx_XGIVEREF((PyObject *)__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_403make_notch(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_402make_notch, "\n return a new notch filter (a delay line with a scaler on the feedforward) of size elements.\n if the notch length will be changing at run-time, max-size sets its maximum length.\n \n :param feedforward: scaler on input\n :param size: delay length \\in samples\n :param initial_contents: delay line's initial values\n :param initial_element: delay line's initial element\n :param max_size: maximum delay size \\in case the delay changes\n :param type: interpolation type\n :return: comb gen\n :rtype: mus_any\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_403make_notch = {"make_notch", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_403make_notch, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_402make_notch};
static PyObject *__pyx_pw_8pysndlib_3clm_403make_notch(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
double __pyx_v_feedforward;
PyObject *__pyx_v_size = 0;
PyObject *__pyx_v_initial_contents = 0;
double __pyx_v_initial_element;
PyObject *__pyx_v_max_size = 0;
enum __pyx_t_8pysndlib_3clm_Interp __pyx_v_interp_type;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("make_notch (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_feedforward,&__pyx_n_s_size,&__pyx_n_s_initial_contents,&__pyx_n_s_initial_element,&__pyx_n_s_max_size,&__pyx_n_s_interp_type,0};
PyObject* values[6] = {0,0,0,0,0,0};
values[1] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
/* … */
/* function exit code */
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_402make_notch(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_feedforward, PyObject *__pyx_v_size, PyObject *__pyx_v_initial_contents, double __pyx_v_initial_element, PyObject *__pyx_v_max_size, enum __pyx_t_8pysndlib_3clm_Interp __pyx_v_interp_type) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_2.__pyx_n = 6;
__pyx_t_2.feedforward = __pyx_v_feedforward;
__pyx_t_2.size = __pyx_v_size;
__pyx_t_2.initial_contents = __pyx_v_initial_contents;
__pyx_t_2.initial_element = __pyx_v_initial_element;
__pyx_t_2.max_size = __pyx_v_max_size;
__pyx_t_2.interp_type = __pyx_v_interp_type;
__pyx_t_1 = ((PyObject *)__pyx_f_8pysndlib_3clm_make_notch(0, &__pyx_t_2)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3913, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("pysndlib.clm.make_notch", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_tuple__477 = PyTuple_Pack(6, __pyx_n_s_feedforward, __pyx_n_s_size, __pyx_n_s_initial_contents, __pyx_n_s_initial_element, __pyx_n_s_max_size, __pyx_n_s_interp_type); if (unlikely(!__pyx_tuple__477)) __PYX_ERR(0, 3913, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__477);
__Pyx_GIVEREF(__pyx_tuple__477);
/* … */
__pyx_t_43 = PyTuple_New(6); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 3913, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
__Pyx_INCREF(__pyx_float_1_0);
__Pyx_GIVEREF(__pyx_float_1_0);
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_43, 0, __pyx_float_1_0)) __PYX_ERR(0, 3913, __pyx_L1_error);
__Pyx_INCREF(Py_None);
__Pyx_GIVEREF(Py_None);
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_43, 1, Py_None)) __PYX_ERR(0, 3913, __pyx_L1_error);
__Pyx_INCREF(Py_None);
__Pyx_GIVEREF(Py_None);
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_43, 2, Py_None)) __PYX_ERR(0, 3913, __pyx_L1_error);
__Pyx_INCREF(__pyx_float_0_0);
__Pyx_GIVEREF(__pyx_float_0_0);
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_43, 3, __pyx_float_0_0)) __PYX_ERR(0, 3913, __pyx_L1_error);
__Pyx_INCREF(Py_None);
__Pyx_GIVEREF(Py_None);
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_43, 4, Py_None)) __PYX_ERR(0, 3913, __pyx_L1_error);
__Pyx_GIVEREF(__pyx_t_40);
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_43, 5, __pyx_t_40)) __PYX_ERR(0, 3913, __pyx_L1_error);
__pyx_t_40 = 0;
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_403make_notch, 0, __pyx_n_s_make_notch, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__478)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 3913, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
__Pyx_CyFunction_SetDefaultsTuple(__pyx_t_40, __pyx_t_43);
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
if (PyDict_SetItem(__pyx_d, __pyx_n_s_make_notch, __pyx_t_40) < 0) __PYX_ERR(0, 3913, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
__pyx_codeobj__478 = (PyObject*)__Pyx_PyCode_New(6, 0, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__477, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_make_notch, 3913, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__478)) __PYX_ERR(0, 3913, __pyx_L1_error)
/* … */
struct __pyx_opt_args_8pysndlib_3clm_make_notch {
int __pyx_n;
double feedforward;
PyObject *size;
PyObject *initial_contents;
double initial_element;
PyObject *max_size;
enum __pyx_t_8pysndlib_3clm_Interp interp_type;
};
+3914: initial_contents=None,
PyObject *__pyx_v_initial_contents = ((PyObject *)Py_None);
double __pyx_v_initial_element = ((double)0.0);
/* … */
values[2] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
3915: cython.double initial_element=0.0,
+3916: max_size=None,
PyObject *__pyx_v_max_size = ((PyObject *)Py_None);
enum __pyx_t_8pysndlib_3clm_Interp __pyx_v_interp_type = __pyx_k__47;
__Pyx_memviewslice __pyx_v_initial_contents_view = { 0, 0, { 0 }, { 0 }, { 0 } };
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = NULL;
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_r = NULL;
if (__pyx_optional_args) {
if (__pyx_optional_args->__pyx_n > 0) {
__pyx_v_feedforward = __pyx_optional_args->feedforward;
if (__pyx_optional_args->__pyx_n > 1) {
__pyx_v_size = __pyx_optional_args->size;
if (__pyx_optional_args->__pyx_n > 2) {
__pyx_v_initial_contents = __pyx_optional_args->initial_contents;
if (__pyx_optional_args->__pyx_n > 3) {
__pyx_v_initial_element = __pyx_optional_args->initial_element;
if (__pyx_optional_args->__pyx_n > 4) {
__pyx_v_max_size = __pyx_optional_args->max_size;
if (__pyx_optional_args->__pyx_n > 5) {
__pyx_v_interp_type = __pyx_optional_args->interp_type;
}
}
}
}
}
}
}
__Pyx_INCREF(__pyx_v_initial_contents);
__Pyx_INCREF(__pyx_v_max_size);
/* … */
values[4] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 6: values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5);
CYTHON_FALLTHROUGH;
case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4);
CYTHON_FALLTHROUGH;
case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
CYTHON_FALLTHROUGH;
case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_feedforward);
if (value) { values[0] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3913, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 1:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_size);
if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3913, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 2:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_initial_contents);
if (value) { values[2] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3913, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 3:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_initial_element);
if (value) { values[3] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3913, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 4:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_max_size);
if (value) { values[4] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3913, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 5:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_interp_type);
if (value) { values[5] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3913, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "make_notch") < 0)) __PYX_ERR(0, 3913, __pyx_L3_error)
}
} else {
switch (__pyx_nargs) {
case 6: values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5);
CYTHON_FALLTHROUGH;
case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4);
CYTHON_FALLTHROUGH;
case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
CYTHON_FALLTHROUGH;
case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
}
if (values[0]) {
__pyx_v_feedforward = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_feedforward == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 3913, __pyx_L3_error)
} else {
__pyx_v_feedforward = ((double)1.0);
}
__pyx_v_size = values[1];
__pyx_v_initial_contents = values[2];
if (values[3]) {
__pyx_v_initial_element = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_initial_element == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 3915, __pyx_L3_error)
} else {
__pyx_v_initial_element = ((double)0.0);
}
__pyx_v_max_size = values[4];
if (values[5]) {
__pyx_v_interp_type = ((enum __pyx_t_8pysndlib_3clm_Interp)__Pyx_PyInt_As_enum____pyx_t_8pysndlib_3clm_Interp(values[5])); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3917, __pyx_L3_error)
} else {
__pyx_v_interp_type = __pyx_k__47;
}
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("make_notch", 0, 0, 6, __pyx_nargs); __PYX_ERR(0, 3913, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.make_notch", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_8pysndlib_3clm_402make_notch(__pyx_self, __pyx_v_feedforward, __pyx_v_size, __pyx_v_initial_contents, __pyx_v_initial_element, __pyx_v_max_size, __pyx_v_interp_type);
+3917: Interp interp_type=Interp.NONE):
__pyx_k__47 = __pyx_e_8pysndlib_3clm_NONE; /* … */ __pyx_t_40 = __Pyx_Enum_Interp_to_py(__pyx_e_8pysndlib_3clm_NONE); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 3917, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_40);
3918:
3919: """
3920: return a new notch filter (a delay line with a scaler on the feedforward) of size elements.
3921: if the notch length will be changing at run-time, max-size sets its maximum length.
3922:
3923: :param feedforward: scaler on input
3924: :param size: delay length \in samples
3925: :param initial_contents: delay line's initial values
3926: :param initial_element: delay line's initial element
3927: :param max_size: maximum delay size \in case the delay changes
3928: :param type: interpolation type
3929: :return: comb gen
3930: :rtype: mus_any
3931: """
3932:
+3933: check_range('size', size, 0.0, None)
__pyx_t_2.__pyx_n = 2; __pyx_t_2.low = __pyx_float_0_0; __pyx_t_2.high = Py_None; __pyx_t_1 = __pyx_f_8pysndlib_3clm_check_range(__pyx_n_s_size, __pyx_v_size, 0, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3933, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3934:
+3935: cdef double [:] initial_contents_view = None
__pyx_t_3 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(Py_None, PyBUF_WRITABLE); if (unlikely(!__pyx_t_3.memview)) __PYX_ERR(0, 3935, __pyx_L1_error) __pyx_v_initial_contents_view = __pyx_t_3; __pyx_t_3.memview = NULL; __pyx_t_3.data = NULL;
3936:
+3937: if not max_size:
__pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_max_size); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 3937, __pyx_L1_error) __pyx_t_5 = (!__pyx_t_4); if (__pyx_t_5) { /* … */ }
+3938: max_size = size
__Pyx_INCREF(__pyx_v_size); __Pyx_DECREF_SET(__pyx_v_max_size, __pyx_v_size);
3939:
+3940: if max_size != size and interp_type == Interp.NONE:
__pyx_t_1 = PyObject_RichCompare(__pyx_v_max_size, __pyx_v_size, Py_NE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3940, __pyx_L1_error) __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 3940, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_4) { } else { __pyx_t_5 = __pyx_t_4; goto __pyx_L5_bool_binop_done; } __pyx_t_4 = (__pyx_v_interp_type == __pyx_e_8pysndlib_3clm_NONE); __pyx_t_5 = __pyx_t_4; __pyx_L5_bool_binop_done:; if (__pyx_t_5) { /* … */ }
+3941: interp_type = Interp.BEZIER #think this is correct from clm2xen.c
__pyx_v_interp_type = __pyx_e_8pysndlib_3clm_BEZIER;
3942:
3943:
+3944: if initial_contents is not None:
__pyx_t_5 = (__pyx_v_initial_contents != Py_None);
if (__pyx_t_5) {
/* … */
goto __pyx_L7;
}
+3945: if isinstance(initial_contents, list):
__pyx_t_5 = PyList_Check(__pyx_v_initial_contents);
if (__pyx_t_5) {
/* … */
}
+3946: initial_contents = np.array(initial_contents)
__Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3946, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_array); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3946, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_6 = NULL; __pyx_t_8 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_7))) { __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_7); if (likely(__pyx_t_6)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7); __Pyx_INCREF(__pyx_t_6); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_7, function); __pyx_t_8 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_v_initial_contents}; __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_7, __pyx_callargs+1-__pyx_t_8, 1+__pyx_t_8); __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3946, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; } __Pyx_DECREF_SET(__pyx_v_initial_contents, __pyx_t_1); __pyx_t_1 = 0;
+3947: check_ndim(initial_contents)
__pyx_t_1 = __pyx_f_8pysndlib_3clm_check_ndim(__pyx_v_initial_contents, 0, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3947, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+3948: initial_contents_view = initial_contents
__pyx_t_3 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_v_initial_contents, PyBUF_WRITABLE); if (unlikely(!__pyx_t_3.memview)) __PYX_ERR(0, 3948, __pyx_L1_error) __PYX_XCLEAR_MEMVIEW(&__pyx_v_initial_contents_view, 1); __pyx_v_initial_contents_view = __pyx_t_3; __pyx_t_3.memview = NULL; __pyx_t_3.data = NULL;
3949:
+3950: elif initial_element:
__pyx_t_5 = (__pyx_v_initial_element != 0);
if (__pyx_t_5) {
/* … */
}
__pyx_L7:;
+3951: initial_contents = np.zeros(max_size, dtype=np.double)
__Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3951, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_zeros); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3951, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3951, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_v_max_size); __Pyx_GIVEREF(__pyx_v_max_size); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_max_size)) __PYX_ERR(0, 3951, __pyx_L1_error); __pyx_t_6 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3951, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 3951, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_double); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 3951, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_dtype, __pyx_t_10) < 0) __PYX_ERR(0, 3951, __pyx_L1_error) __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_1, __pyx_t_6); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 3951, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF_SET(__pyx_v_initial_contents, __pyx_t_10); __pyx_t_10 = 0;
+3952: check_ndim(initial_contents)
__pyx_t_10 = __pyx_f_8pysndlib_3clm_check_ndim(__pyx_v_initial_contents, 0, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 3952, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+3953: initial_contents.fill(initial_element)
__pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_initial_contents, __pyx_n_s_fill); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3953, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_1 = PyFloat_FromDouble(__pyx_v_initial_element); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3953, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_7 = NULL; __pyx_t_8 = 0; #if CYTHON_UNPACK_METHODS if (likely(PyMethod_Check(__pyx_t_6))) { __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6); if (likely(__pyx_t_7)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); __Pyx_INCREF(__pyx_t_7); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_6, function); __pyx_t_8 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_t_1}; __pyx_t_10 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+1-__pyx_t_8, 1+__pyx_t_8); __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 3953, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; } __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+3954: initial_contents_view = initial_contents
__pyx_t_3 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_v_initial_contents, PyBUF_WRITABLE); if (unlikely(!__pyx_t_3.memview)) __PYX_ERR(0, 3954, __pyx_L1_error) __PYX_XCLEAR_MEMVIEW(&__pyx_v_initial_contents_view, 1); __pyx_v_initial_contents_view = __pyx_t_3; __pyx_t_3.memview = NULL; __pyx_t_3.data = NULL;
3955:
+3956: if initial_contents_view is not None:
__pyx_t_5 = (((PyObject *) __pyx_v_initial_contents_view.memview) != Py_None);
if (__pyx_t_5) {
/* … */
goto __pyx_L9;
}
+3957: gen = mus_any.from_ptr(cclm.mus_make_notch(feedforward, size, &initial_contents_view[0], max_size, <cclm.mus_interp_t>interp_type))
__pyx_t_8 = __Pyx_PyInt_As_int(__pyx_v_size); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3957, __pyx_L1_error) __pyx_t_11 = 0; __pyx_t_12 = -1; if (__pyx_t_11 < 0) { __pyx_t_11 += __pyx_v_initial_contents_view.shape[0]; if (unlikely(__pyx_t_11 < 0)) __pyx_t_12 = 0; } else if (unlikely(__pyx_t_11 >= __pyx_v_initial_contents_view.shape[0])) __pyx_t_12 = 0; if (unlikely(__pyx_t_12 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_12); __PYX_ERR(0, 3957, __pyx_L1_error) } __pyx_t_12 = __Pyx_PyInt_As_int(__pyx_v_max_size); if (unlikely((__pyx_t_12 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3957, __pyx_L1_error) __pyx_t_10 = ((PyObject *)__pyx_vtabptr_8pysndlib_3clm_mus_any->from_ptr(mus_make_notch(__pyx_v_feedforward, __pyx_t_8, (&(*((double *) ( /* dim=0 */ (__pyx_v_initial_contents_view.data + __pyx_t_11 * __pyx_v_initial_contents_view.strides[0]) )))), __pyx_t_12, ((mus_interp_t)__pyx_v_interp_type)), NULL)); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 3957, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_t_10); __pyx_t_10 = 0;
3958: else:
+3959: gen = mus_any.from_ptr(cclm.mus_make_notch(feedforward, size, NULL, max_size, <cclm.mus_interp_t>interp_type))
/*else*/ {
__pyx_t_12 = __Pyx_PyInt_As_int(__pyx_v_size); if (unlikely((__pyx_t_12 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3959, __pyx_L1_error)
__pyx_t_8 = __Pyx_PyInt_As_int(__pyx_v_max_size); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3959, __pyx_L1_error)
__pyx_t_10 = ((PyObject *)__pyx_vtabptr_8pysndlib_3clm_mus_any->from_ptr(mus_make_notch(__pyx_v_feedforward, __pyx_t_12, NULL, __pyx_t_8, ((mus_interp_t)__pyx_v_interp_type)), NULL)); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 3959, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_10);
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_t_10);
__pyx_t_10 = 0;
}
__pyx_L9:;
+3960: gen.cache_append(initial_contents)
__pyx_t_10 = ((struct __pyx_vtabstruct_8pysndlib_3clm_mus_any *)__pyx_v_gen->__pyx_vtab)->cache_append(__pyx_v_gen, __pyx_v_initial_contents, 0); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 3960, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+3961: return gen
__Pyx_XDECREF((PyObject *)__pyx_r); __Pyx_INCREF((PyObject *)__pyx_v_gen); __pyx_r = __pyx_v_gen; goto __pyx_L0;
3962:
+3963: cpdef cython.double notch(mus_any gen, cython.double insig, cython.double pm=0.0):
static PyObject *__pyx_pw_8pysndlib_3clm_405notch(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static double __pyx_f_8pysndlib_3clm_notch(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, double __pyx_v_insig, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_8pysndlib_3clm_notch *__pyx_optional_args) {
double __pyx_v_pm = ((double)0.0);
double __pyx_r;
if (__pyx_optional_args) {
if (__pyx_optional_args->__pyx_n > 0) {
__pyx_v_pm = __pyx_optional_args->pm;
}
}
/* … */
/* function exit code */
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_405notch(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_404notch, "\n notch filter val, pm changes the delay length.\n \n :param gen: notch gen\n :param insig: input value\n :param pm: change \\in delay length size. can be + or -\n :rtype: float\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_405notch = {"notch", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_405notch, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_404notch};
static PyObject *__pyx_pw_8pysndlib_3clm_405notch(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = 0;
double __pyx_v_insig;
double __pyx_v_pm;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("notch (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gen,&__pyx_n_s_insig,&__pyx_n_s_pm,0};
PyObject* values[3] = {0,0,0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_gen)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3963, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_insig)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3963, __pyx_L3_error)
else {
__Pyx_RaiseArgtupleInvalid("notch", 0, 2, 3, 1); __PYX_ERR(0, 3963, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 2:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pm);
if (value) { values[2] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3963, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "notch") < 0)) __PYX_ERR(0, 3963, __pyx_L3_error)
}
} else {
switch (__pyx_nargs) {
case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
break;
default: goto __pyx_L5_argtuple_error;
}
}
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)values[0]);
__pyx_v_insig = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_insig == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 3963, __pyx_L3_error)
if (values[2]) {
__pyx_v_pm = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_pm == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 3963, __pyx_L3_error)
} else {
__pyx_v_pm = ((double)0.0);
}
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("notch", 0, 2, 3, __pyx_nargs); __PYX_ERR(0, 3963, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.notch", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gen), __pyx_ptype_8pysndlib_3clm_mus_any, 1, "gen", 0))) __PYX_ERR(0, 3963, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_404notch(__pyx_self, __pyx_v_gen, __pyx_v_insig, __pyx_v_pm);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_404notch(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, double __pyx_v_insig, double __pyx_v_pm) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_2.__pyx_n = 1;
__pyx_t_2.pm = __pyx_v_pm;
__pyx_t_1 = __pyx_f_8pysndlib_3clm_notch(__pyx_v_gen, __pyx_v_insig, 0, &__pyx_t_2); if (unlikely(__pyx_t_1 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 3963, __pyx_L1_error)
__pyx_t_3 = PyFloat_FromDouble(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3963, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__pyx_r = __pyx_t_3;
__pyx_t_3 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_3);
__Pyx_AddTraceback("pysndlib.clm.notch", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_codeobj__479 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__448, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_notch, 3963, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__479)) __PYX_ERR(0, 3963, __pyx_L1_error)
/* … */
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_405notch, 0, __pyx_n_s_notch, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__479)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 3963, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
__Pyx_CyFunction_SetDefaultsTuple(__pyx_t_40, __pyx_tuple__480);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_notch, __pyx_t_40) < 0) __PYX_ERR(0, 3963, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
__pyx_tuple__480 = PyTuple_Pack(1, __pyx_float_0_0); if (unlikely(!__pyx_tuple__480)) __PYX_ERR(0, 3963, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__480);
__Pyx_GIVEREF(__pyx_tuple__480);
3964: """
3965: notch filter val, pm changes the delay length.
3966:
3967: :param gen: notch gen
3968: :param insig: input value
3969: :param pm: change \in delay length size. can be + or -
3970: :rtype: float
3971: """
+3972: return cclm.mus_notch(gen._ptr, insig, pm)
__pyx_r = mus_notch(__pyx_v_gen->_ptr, __pyx_v_insig, __pyx_v_pm); goto __pyx_L0;
3973:
3974:
+3975: cpdef cython.double notch_unmodulated(mus_any gen, cython.double insig):
static PyObject *__pyx_pw_8pysndlib_3clm_407notch_unmodulated(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static double __pyx_f_8pysndlib_3clm_notch_unmodulated(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, double __pyx_v_insig, CYTHON_UNUSED int __pyx_skip_dispatch) {
double __pyx_r;
/* … */
/* function exit code */
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_407notch_unmodulated(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_406notch_unmodulated, "\n notch filter val, pm changes the delay length. unmodulated\n \n :param gen: notch gen\n :param insig: input value\n :rtype: float\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_407notch_unmodulated = {"notch_unmodulated", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_407notch_unmodulated, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_406notch_unmodulated};
static PyObject *__pyx_pw_8pysndlib_3clm_407notch_unmodulated(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = 0;
double __pyx_v_insig;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("notch_unmodulated (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gen,&__pyx_n_s_insig,0};
PyObject* values[2] = {0,0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_gen)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3975, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_insig)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3975, __pyx_L3_error)
else {
__Pyx_RaiseArgtupleInvalid("notch_unmodulated", 1, 2, 2, 1); __PYX_ERR(0, 3975, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "notch_unmodulated") < 0)) __PYX_ERR(0, 3975, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 2)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
}
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)values[0]);
__pyx_v_insig = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_insig == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 3975, __pyx_L3_error)
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("notch_unmodulated", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 3975, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.notch_unmodulated", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gen), __pyx_ptype_8pysndlib_3clm_mus_any, 1, "gen", 0))) __PYX_ERR(0, 3975, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_406notch_unmodulated(__pyx_self, __pyx_v_gen, __pyx_v_insig);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_406notch_unmodulated(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, double __pyx_v_insig) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8pysndlib_3clm_notch_unmodulated(__pyx_v_gen, __pyx_v_insig, 0); if (unlikely(__pyx_t_1 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 3975, __pyx_L1_error)
__pyx_t_2 = PyFloat_FromDouble(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3975, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("pysndlib.clm.notch_unmodulated", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_407notch_unmodulated, 0, __pyx_n_s_notch_unmodulated, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__481)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 3975, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_notch_unmodulated, __pyx_t_40) < 0) __PYX_ERR(0, 3975, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
/* … */
__pyx_codeobj__481 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__380, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_notch_unmodulated, 3975, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__481)) __PYX_ERR(0, 3975, __pyx_L1_error)
3976: """
3977: notch filter val, pm changes the delay length. unmodulated
3978:
3979: :param gen: notch gen
3980: :param insig: input value
3981: :rtype: float
3982: """
+3983: return cclm.mus_notch_unmodulated(gen._ptr, insig)
__pyx_r = mus_notch_unmodulated(__pyx_v_gen->_ptr, __pyx_v_insig); goto __pyx_L0;
3984:
3985:
+3986: cpdef bint is_notch(mus_any gen):
static PyObject *__pyx_pw_8pysndlib_3clm_409is_notch(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static int __pyx_f_8pysndlib_3clm_is_notch(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, CYTHON_UNUSED int __pyx_skip_dispatch) {
int __pyx_r;
/* … */
/* function exit code */
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_409is_notch(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_408is_notch, "\n returns True if gen is a notch.\n \n :param gen: gen\n :rtype: bool\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_409is_notch = {"is_notch", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_409is_notch, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_408is_notch};
static PyObject *__pyx_pw_8pysndlib_3clm_409is_notch(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("is_notch (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gen,0};
PyObject* values[1] = {0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_gen)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3986, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "is_notch") < 0)) __PYX_ERR(0, 3986, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 1)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
}
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)values[0]);
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("is_notch", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 3986, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.is_notch", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gen), __pyx_ptype_8pysndlib_3clm_mus_any, 1, "gen", 0))) __PYX_ERR(0, 3986, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_408is_notch(__pyx_self, __pyx_v_gen);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_408is_notch(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8pysndlib_3clm_is_notch(__pyx_v_gen, 0); if (unlikely(__pyx_t_1 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3986, __pyx_L1_error)
__pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3986, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("pysndlib.clm.is_notch", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_409is_notch, 0, __pyx_n_s_is_notch, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__482)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 3986, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_is_notch, __pyx_t_40) < 0) __PYX_ERR(0, 3986, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
/* … */
__pyx_codeobj__482 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__56, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_is_notch, 3986, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__482)) __PYX_ERR(0, 3986, __pyx_L1_error)
3987: """
3988: returns True if gen is a notch.
3989:
3990: :param gen: gen
3991: :rtype: bool
3992: """
+3993: return cclm.mus_is_notch(gen._ptr)
__pyx_r = mus_is_notch(__pyx_v_gen->_ptr); goto __pyx_L0;
3994:
3995: # ---------------- all-pass ---------------- #
+3996: cpdef mus_any make_all_pass(cython.double feedback, cython.double feedforward, cython.long size, initial_contents= None, cython.double initial_element = 0.0, max_size= None, Interp interp_type = Interp.NONE):
static PyObject *__pyx_pw_8pysndlib_3clm_411make_all_pass(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_f_8pysndlib_3clm_make_all_pass(double __pyx_v_feedback, double __pyx_v_feedforward, long __pyx_v_size, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_8pysndlib_3clm_make_all_pass *__pyx_optional_args) {
PyObject *__pyx_v_initial_contents = ((PyObject *)Py_None);
double __pyx_v_initial_element = ((double)0.0);
PyObject *__pyx_v_max_size = ((PyObject *)Py_None);
enum __pyx_t_8pysndlib_3clm_Interp __pyx_v_interp_type = __pyx_k__48;
__Pyx_memviewslice __pyx_v_initial_contents_view = { 0, 0, { 0 }, { 0 }, { 0 } };
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = NULL;
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_r = NULL;
if (__pyx_optional_args) {
if (__pyx_optional_args->__pyx_n > 0) {
__pyx_v_initial_contents = __pyx_optional_args->initial_contents;
if (__pyx_optional_args->__pyx_n > 1) {
__pyx_v_initial_element = __pyx_optional_args->initial_element;
if (__pyx_optional_args->__pyx_n > 2) {
__pyx_v_max_size = __pyx_optional_args->max_size;
if (__pyx_optional_args->__pyx_n > 3) {
__pyx_v_interp_type = __pyx_optional_args->interp_type;
}
}
}
}
}
__Pyx_INCREF(__pyx_v_initial_contents);
__Pyx_INCREF(__pyx_v_max_size);
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__PYX_XCLEAR_MEMVIEW(&__pyx_t_4, 1);
__Pyx_XDECREF(__pyx_t_7);
__Pyx_XDECREF(__pyx_t_9);
__Pyx_XDECREF(__pyx_t_10);
__Pyx_AddTraceback("pysndlib.clm.make_all_pass", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__PYX_XCLEAR_MEMVIEW(&__pyx_v_initial_contents_view, 1);
__Pyx_XDECREF((PyObject *)__pyx_v_gen);
__Pyx_XDECREF(__pyx_v_initial_contents);
__Pyx_XDECREF(__pyx_v_max_size);
__Pyx_XGIVEREF((PyObject *)__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_411make_all_pass(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_410make_all_pass, "\n return a new allpass filter (a delay line with a scalers on both the feedback and the feedforward).\n if length will be changing at run-time, max-size sets its maximum length.\n \n :param feedback: scaler on feedback\n :param feedforward: scaler on input\n :param size: length \\in samples of the delay line\n :param initial_contents: delay line's initial values\n :param initial_element: delay line's initial element\n :param max_size: maximum delay size \\in case the delay changes\n :param interp_type: interpolation type\n :return: a new allpass filter\n :rtype: mus_any\n \n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_411make_all_pass = {"make_all_pass", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_411make_all_pass, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_410make_all_pass};
static PyObject *__pyx_pw_8pysndlib_3clm_411make_all_pass(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
double __pyx_v_feedback;
double __pyx_v_feedforward;
long __pyx_v_size;
PyObject *__pyx_v_initial_contents = 0;
double __pyx_v_initial_element;
PyObject *__pyx_v_max_size = 0;
enum __pyx_t_8pysndlib_3clm_Interp __pyx_v_interp_type;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("make_all_pass (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_feedback,&__pyx_n_s_feedforward,&__pyx_n_s_size,&__pyx_n_s_initial_contents,&__pyx_n_s_initial_element,&__pyx_n_s_max_size,&__pyx_n_s_interp_type,0};
PyObject* values[7] = {0,0,0,0,0,0,0};
values[3] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
values[5] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 7: values[6] = __Pyx_Arg_FASTCALL(__pyx_args, 6);
CYTHON_FALLTHROUGH;
case 6: values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5);
CYTHON_FALLTHROUGH;
case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4);
CYTHON_FALLTHROUGH;
case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
CYTHON_FALLTHROUGH;
case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_feedback)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3996, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_feedforward)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3996, __pyx_L3_error)
else {
__Pyx_RaiseArgtupleInvalid("make_all_pass", 0, 3, 7, 1); __PYX_ERR(0, 3996, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 2:
if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_size)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[2]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3996, __pyx_L3_error)
else {
__Pyx_RaiseArgtupleInvalid("make_all_pass", 0, 3, 7, 2); __PYX_ERR(0, 3996, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 3:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_initial_contents);
if (value) { values[3] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3996, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 4:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_initial_element);
if (value) { values[4] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3996, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 5:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_max_size);
if (value) { values[5] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3996, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 6:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_interp_type);
if (value) { values[6] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3996, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "make_all_pass") < 0)) __PYX_ERR(0, 3996, __pyx_L3_error)
}
} else {
switch (__pyx_nargs) {
case 7: values[6] = __Pyx_Arg_FASTCALL(__pyx_args, 6);
CYTHON_FALLTHROUGH;
case 6: values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5);
CYTHON_FALLTHROUGH;
case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4);
CYTHON_FALLTHROUGH;
case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
CYTHON_FALLTHROUGH;
case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
break;
default: goto __pyx_L5_argtuple_error;
}
}
__pyx_v_feedback = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_feedback == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 3996, __pyx_L3_error)
__pyx_v_feedforward = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_feedforward == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 3996, __pyx_L3_error)
__pyx_v_size = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_size == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 3996, __pyx_L3_error)
__pyx_v_initial_contents = values[3];
if (values[4]) {
__pyx_v_initial_element = __pyx_PyFloat_AsDouble(values[4]); if (unlikely((__pyx_v_initial_element == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 3996, __pyx_L3_error)
} else {
__pyx_v_initial_element = ((double)0.0);
}
__pyx_v_max_size = values[5];
if (values[6]) {
__pyx_v_interp_type = ((enum __pyx_t_8pysndlib_3clm_Interp)__Pyx_PyInt_As_enum____pyx_t_8pysndlib_3clm_Interp(values[6])); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3996, __pyx_L3_error)
} else {
__pyx_v_interp_type = __pyx_k__48;
}
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("make_all_pass", 0, 3, 7, __pyx_nargs); __PYX_ERR(0, 3996, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.make_all_pass", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_8pysndlib_3clm_410make_all_pass(__pyx_self, __pyx_v_feedback, __pyx_v_feedforward, __pyx_v_size, __pyx_v_initial_contents, __pyx_v_initial_element, __pyx_v_max_size, __pyx_v_interp_type);
/* function exit code */
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_410make_all_pass(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_feedback, double __pyx_v_feedforward, long __pyx_v_size, PyObject *__pyx_v_initial_contents, double __pyx_v_initial_element, PyObject *__pyx_v_max_size, enum __pyx_t_8pysndlib_3clm_Interp __pyx_v_interp_type) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_2.__pyx_n = 4;
__pyx_t_2.initial_contents = __pyx_v_initial_contents;
__pyx_t_2.initial_element = __pyx_v_initial_element;
__pyx_t_2.max_size = __pyx_v_max_size;
__pyx_t_2.interp_type = __pyx_v_interp_type;
__pyx_t_1 = ((PyObject *)__pyx_f_8pysndlib_3clm_make_all_pass(__pyx_v_feedback, __pyx_v_feedforward, __pyx_v_size, 0, &__pyx_t_2)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3996, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("pysndlib.clm.make_all_pass", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_k__48 = __pyx_e_8pysndlib_3clm_NONE;
/* … */
__pyx_tuple__483 = PyTuple_Pack(7, __pyx_n_s_feedback, __pyx_n_s_feedforward, __pyx_n_s_size, __pyx_n_s_initial_contents, __pyx_n_s_initial_element, __pyx_n_s_max_size, __pyx_n_s_interp_type); if (unlikely(!__pyx_tuple__483)) __PYX_ERR(0, 3996, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__483);
__Pyx_GIVEREF(__pyx_tuple__483);
__pyx_t_40 = __Pyx_Enum_Interp_to_py(__pyx_e_8pysndlib_3clm_NONE); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 3996, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
__pyx_t_43 = PyTuple_New(4); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 3996, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
__Pyx_INCREF(Py_None);
__Pyx_GIVEREF(Py_None);
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_43, 0, Py_None)) __PYX_ERR(0, 3996, __pyx_L1_error);
__Pyx_INCREF(__pyx_float_0_0);
__Pyx_GIVEREF(__pyx_float_0_0);
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_43, 1, __pyx_float_0_0)) __PYX_ERR(0, 3996, __pyx_L1_error);
__Pyx_INCREF(Py_None);
__Pyx_GIVEREF(Py_None);
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_43, 2, Py_None)) __PYX_ERR(0, 3996, __pyx_L1_error);
__Pyx_GIVEREF(__pyx_t_40);
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_43, 3, __pyx_t_40)) __PYX_ERR(0, 3996, __pyx_L1_error);
__pyx_t_40 = 0;
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_411make_all_pass, 0, __pyx_n_s_make_all_pass, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__484)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 3996, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
__Pyx_CyFunction_SetDefaultsTuple(__pyx_t_40, __pyx_t_43);
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
if (PyDict_SetItem(__pyx_d, __pyx_n_s_make_all_pass, __pyx_t_40) < 0) __PYX_ERR(0, 3996, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
__pyx_codeobj__484 = (PyObject*)__Pyx_PyCode_New(7, 0, 0, 7, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__483, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_make_all_pass, 3996, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__484)) __PYX_ERR(0, 3996, __pyx_L1_error)
3997:
3998: """
3999: return a new allpass filter (a delay line with a scalers on both the feedback and the feedforward).
4000: if length will be changing at run-time, max-size sets its maximum length.
4001:
4002: :param feedback: scaler on feedback
4003: :param feedforward: scaler on input
4004: :param size: length \in samples of the delay line
4005: :param initial_contents: delay line's initial values
4006: :param initial_element: delay line's initial element
4007: :param max_size: maximum delay size \in case the delay changes
4008: :param interp_type: interpolation type
4009: :return: a new allpass filter
4010: :rtype: mus_any
4011:
4012: """
4013:
+4014: check_range('size', size, 0.0, None)
__pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4014, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_3.__pyx_n = 2; __pyx_t_3.low = __pyx_float_0_0; __pyx_t_3.high = Py_None; __pyx_t_2 = __pyx_f_8pysndlib_3clm_check_range(__pyx_n_s_size, __pyx_t_1, 0, &__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4014, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4015:
+4016: cdef double [:] initial_contents_view = None
__pyx_t_4 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(Py_None, PyBUF_WRITABLE); if (unlikely(!__pyx_t_4.memview)) __PYX_ERR(0, 4016, __pyx_L1_error) __pyx_v_initial_contents_view = __pyx_t_4; __pyx_t_4.memview = NULL; __pyx_t_4.data = NULL;
4017:
+4018: if not max_size:
__pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_max_size); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 4018, __pyx_L1_error) __pyx_t_6 = (!__pyx_t_5); if (__pyx_t_6) { /* … */ }
+4019: max_size = size
__pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v_size); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4019, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF_SET(__pyx_v_max_size, __pyx_t_2); __pyx_t_2 = 0;
4020:
+4021: if max_size != size and interp_type == Interp.NONE:
__pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v_size); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4021, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_1 = PyObject_RichCompare(__pyx_v_max_size, __pyx_t_2, Py_NE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4021, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 4021, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_5) { } else { __pyx_t_6 = __pyx_t_5; goto __pyx_L5_bool_binop_done; } __pyx_t_5 = (__pyx_v_interp_type == __pyx_e_8pysndlib_3clm_NONE); __pyx_t_6 = __pyx_t_5; __pyx_L5_bool_binop_done:; if (__pyx_t_6) { /* … */ }
+4022: interp_type = Interp.HERMITE #think this is correct from clm2xen.c
__pyx_v_interp_type = __pyx_e_8pysndlib_3clm_HERMITE;
4023:
4024:
+4025: if initial_contents is not None:
__pyx_t_6 = (__pyx_v_initial_contents != Py_None);
if (__pyx_t_6) {
/* … */
goto __pyx_L7;
}
+4026: if isinstance(initial_contents, list):
__pyx_t_6 = PyList_Check(__pyx_v_initial_contents);
if (__pyx_t_6) {
/* … */
}
+4027: initial_contents = np.array(initial_contents)
__Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4027, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_array); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 4027, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = NULL; __pyx_t_8 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_7))) { __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_7); if (likely(__pyx_t_2)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7); __Pyx_INCREF(__pyx_t_2); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_7, function); __pyx_t_8 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_v_initial_contents}; __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_7, __pyx_callargs+1-__pyx_t_8, 1+__pyx_t_8); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4027, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; } __Pyx_DECREF_SET(__pyx_v_initial_contents, __pyx_t_1); __pyx_t_1 = 0;
+4028: check_ndim(initial_contents)
__pyx_t_1 = __pyx_f_8pysndlib_3clm_check_ndim(__pyx_v_initial_contents, 0, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4028, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+4029: initial_contents_view = initial_contents
__pyx_t_4 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_v_initial_contents, PyBUF_WRITABLE); if (unlikely(!__pyx_t_4.memview)) __PYX_ERR(0, 4029, __pyx_L1_error) __PYX_XCLEAR_MEMVIEW(&__pyx_v_initial_contents_view, 1); __pyx_v_initial_contents_view = __pyx_t_4; __pyx_t_4.memview = NULL; __pyx_t_4.data = NULL;
4030:
+4031: elif initial_element:
__pyx_t_6 = (__pyx_v_initial_element != 0);
if (__pyx_t_6) {
/* … */
}
__pyx_L7:;
+4032: initial_contents = np.zeros(max_size, dtype=np.double)
__Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4032, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_zeros); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 4032, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4032, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_v_max_size); __Pyx_GIVEREF(__pyx_v_max_size); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_max_size)) __PYX_ERR(0, 4032, __pyx_L1_error); __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4032, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 4032, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_double); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 4032, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_dtype, __pyx_t_10) < 0) __PYX_ERR(0, 4032, __pyx_L1_error) __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 4032, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF_SET(__pyx_v_initial_contents, __pyx_t_10); __pyx_t_10 = 0;
+4033: check_ndim(initial_contents)
__pyx_t_10 = __pyx_f_8pysndlib_3clm_check_ndim(__pyx_v_initial_contents, 0, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 4033, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+4034: initial_contents.fill(initial_element)
__pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_initial_contents, __pyx_n_s_fill); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4034, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_1 = PyFloat_FromDouble(__pyx_v_initial_element); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4034, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_7 = NULL; __pyx_t_8 = 0; #if CYTHON_UNPACK_METHODS if (likely(PyMethod_Check(__pyx_t_2))) { __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_7)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_7); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); __pyx_t_8 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_t_1}; __pyx_t_10 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_8, 1+__pyx_t_8); __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 4034, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+4035: initial_contents_view = initial_contents
__pyx_t_4 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_v_initial_contents, PyBUF_WRITABLE); if (unlikely(!__pyx_t_4.memview)) __PYX_ERR(0, 4035, __pyx_L1_error) __PYX_XCLEAR_MEMVIEW(&__pyx_v_initial_contents_view, 1); __pyx_v_initial_contents_view = __pyx_t_4; __pyx_t_4.memview = NULL; __pyx_t_4.data = NULL;
4036:
+4037: if initial_contents_view is not None:
__pyx_t_6 = (((PyObject *) __pyx_v_initial_contents_view.memview) != Py_None);
if (__pyx_t_6) {
/* … */
goto __pyx_L9;
}
+4038: gen = mus_any.from_ptr(cclm.mus_make_all_pass(feedback,feedforward, size, &initial_contents_view[0], max_size, <cclm.mus_interp_t>interp_type))
__pyx_t_11 = 0;
__pyx_t_8 = -1;
if (__pyx_t_11 < 0) {
__pyx_t_11 += __pyx_v_initial_contents_view.shape[0];
if (unlikely(__pyx_t_11 < 0)) __pyx_t_8 = 0;
} else if (unlikely(__pyx_t_11 >= __pyx_v_initial_contents_view.shape[0])) __pyx_t_8 = 0;
if (unlikely(__pyx_t_8 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_8);
__PYX_ERR(0, 4038, __pyx_L1_error)
}
__pyx_t_8 = __Pyx_PyInt_As_int(__pyx_v_max_size); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 4038, __pyx_L1_error)
__pyx_t_10 = ((PyObject *)__pyx_vtabptr_8pysndlib_3clm_mus_any->from_ptr(mus_make_all_pass(__pyx_v_feedback, __pyx_v_feedforward, __pyx_v_size, (&(*((double *) ( /* dim=0 */ (__pyx_v_initial_contents_view.data + __pyx_t_11 * __pyx_v_initial_contents_view.strides[0]) )))), __pyx_t_8, ((mus_interp_t)__pyx_v_interp_type)), NULL)); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 4038, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_10);
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_t_10);
__pyx_t_10 = 0;
4039: else:
+4040: gen = mus_any.from_ptr(cclm.mus_make_all_pass(feedback,feedforward, size,NULL, max_size, <cclm.mus_interp_t>interp_type))
/*else*/ {
__pyx_t_8 = __Pyx_PyInt_As_int(__pyx_v_max_size); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 4040, __pyx_L1_error)
__pyx_t_10 = ((PyObject *)__pyx_vtabptr_8pysndlib_3clm_mus_any->from_ptr(mus_make_all_pass(__pyx_v_feedback, __pyx_v_feedforward, __pyx_v_size, NULL, __pyx_t_8, ((mus_interp_t)__pyx_v_interp_type)), NULL)); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 4040, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_10);
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_t_10);
__pyx_t_10 = 0;
}
__pyx_L9:;
+4041: gen.cache_append(initial_contents)
__pyx_t_10 = ((struct __pyx_vtabstruct_8pysndlib_3clm_mus_any *)__pyx_v_gen->__pyx_vtab)->cache_append(__pyx_v_gen, __pyx_v_initial_contents, 0); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 4041, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+4042: return gen
__Pyx_XDECREF((PyObject *)__pyx_r); __Pyx_INCREF((PyObject *)__pyx_v_gen); __pyx_r = __pyx_v_gen; goto __pyx_L0;
4043:
+4044: cpdef cython.double all_pass(gen: mus_any, insig: float, pm: Optional[float]=None):
static PyObject *__pyx_pw_8pysndlib_3clm_413all_pass(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static double __pyx_f_8pysndlib_3clm_all_pass(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, double __pyx_v_insig, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_8pysndlib_3clm_all_pass *__pyx_optional_args) {
PyObject *__pyx_v_pm = ((PyObject *)Py_None);
double __pyx_r;
if (__pyx_optional_args) {
if (__pyx_optional_args->__pyx_n > 0) {
__pyx_v_pm = __pyx_optional_args->pm;
}
}
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_AddTraceback("pysndlib.clm.all_pass", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = -1;
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_413all_pass(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_412all_pass, "\n all-pass filter insig value, pm changes the delay length.\n \n :param gen: all_pass gen\n :param insig: input value\n :param pm: change \\in delay length size. can be + or -\n :rtype: float\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_413all_pass = {"all_pass", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_413all_pass, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_412all_pass};
static PyObject *__pyx_pw_8pysndlib_3clm_413all_pass(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = 0;
double __pyx_v_insig;
PyObject *__pyx_v_pm = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("all_pass (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gen,&__pyx_n_s_insig,&__pyx_n_s_pm,0};
PyObject* values[3] = {0,0,0};
values[2] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_gen)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4044, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_insig)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4044, __pyx_L3_error)
else {
__Pyx_RaiseArgtupleInvalid("all_pass", 0, 2, 3, 1); __PYX_ERR(0, 4044, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 2:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pm);
if (value) { values[2] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4044, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "all_pass") < 0)) __PYX_ERR(0, 4044, __pyx_L3_error)
}
} else {
switch (__pyx_nargs) {
case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
break;
default: goto __pyx_L5_argtuple_error;
}
}
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)values[0]);
__pyx_v_insig = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_insig == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 4044, __pyx_L3_error)
__pyx_v_pm = values[2];
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("all_pass", 0, 2, 3, __pyx_nargs); __PYX_ERR(0, 4044, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.all_pass", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gen), __pyx_ptype_8pysndlib_3clm_mus_any, 0, "gen", 0))) __PYX_ERR(0, 4044, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_412all_pass(__pyx_self, __pyx_v_gen, __pyx_v_insig, __pyx_v_pm);
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_412all_pass(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, double __pyx_v_insig, PyObject *__pyx_v_pm) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_2.__pyx_n = 1;
__pyx_t_2.pm = __pyx_v_pm;
__pyx_t_1 = __pyx_f_8pysndlib_3clm_all_pass(__pyx_v_gen, __pyx_v_insig, 0, &__pyx_t_2); if (unlikely(__pyx_t_1 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 4044, __pyx_L1_error)
__pyx_t_3 = PyFloat_FromDouble(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4044, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__pyx_r = __pyx_t_3;
__pyx_t_3 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_3);
__Pyx_AddTraceback("pysndlib.clm.all_pass", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_40 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 4044, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
if (PyDict_SetItem(__pyx_t_40, __pyx_n_s_gen, __pyx_n_s_mus_any) < 0) __PYX_ERR(0, 4044, __pyx_L1_error)
if (PyDict_SetItem(__pyx_t_40, __pyx_n_s_insig, __pyx_n_s_float) < 0) __PYX_ERR(0, 4044, __pyx_L1_error)
if (PyDict_SetItem(__pyx_t_40, __pyx_n_s_pm, __pyx_kp_s_Optional_float) < 0) __PYX_ERR(0, 4044, __pyx_L1_error)
__pyx_t_43 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_413all_pass, 0, __pyx_n_s_all_pass, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__485)); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 4044, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
__Pyx_CyFunction_SetDefaultsTuple(__pyx_t_43, __pyx_tuple__90);
__Pyx_CyFunction_SetAnnotationsDict(__pyx_t_43, __pyx_t_40);
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
if (PyDict_SetItem(__pyx_d, __pyx_n_s_all_pass, __pyx_t_43) < 0) __PYX_ERR(0, 4044, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
/* … */
__pyx_codeobj__485 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__448, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_all_pass, 4044, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__485)) __PYX_ERR(0, 4044, __pyx_L1_error)
/* … */
struct __pyx_opt_args_8pysndlib_3clm_all_pass {
int __pyx_n;
PyObject *pm;
};
4045: """
4046: all-pass filter insig value, pm changes the delay length.
4047:
4048: :param gen: all_pass gen
4049: :param insig: input value
4050: :param pm: change \in delay length size. can be + or -
4051: :rtype: float
4052: """
+4053: if pm:
__pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_pm); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 4053, __pyx_L1_error) if (__pyx_t_1) { /* … */ }
+4054: return cclm.mus_all_pass(gen._ptr, insig, pm)
__pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_v_pm); if (unlikely((__pyx_t_2 == ((mus_float_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 4054, __pyx_L1_error) __pyx_r = mus_all_pass(__pyx_v_gen->_ptr, __pyx_v_insig, __pyx_t_2); goto __pyx_L0;
4055: else:
+4056: return cclm.mus_all_pass_unmodulated(gen._ptr, insig)
/*else*/ {
__pyx_r = mus_all_pass_unmodulated(__pyx_v_gen->_ptr, __pyx_v_insig);
goto __pyx_L0;
}
4057:
+4058: cpdef is_all_pass(gen: mus_any):
static PyObject *__pyx_pw_8pysndlib_3clm_415is_all_pass(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyObject *__pyx_f_8pysndlib_3clm_is_all_pass(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, CYTHON_UNUSED int __pyx_skip_dispatch) {
PyObject *__pyx_r = NULL;
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("pysndlib.clm.is_all_pass", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_415is_all_pass(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_414is_all_pass, "\n returns True if gen is a all_pass.\n \n :param gen: gen\n :rtype: bool\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_415is_all_pass = {"is_all_pass", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_415is_all_pass, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_414is_all_pass};
static PyObject *__pyx_pw_8pysndlib_3clm_415is_all_pass(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("is_all_pass (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gen,0};
PyObject* values[1] = {0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_gen)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4058, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "is_all_pass") < 0)) __PYX_ERR(0, 4058, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 1)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
}
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)values[0]);
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("is_all_pass", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 4058, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.is_all_pass", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gen), __pyx_ptype_8pysndlib_3clm_mus_any, 0, "gen", 0))) __PYX_ERR(0, 4058, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_414is_all_pass(__pyx_self, __pyx_v_gen);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_414is_all_pass(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8pysndlib_3clm_is_all_pass(__pyx_v_gen, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4058, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("pysndlib.clm.is_all_pass", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_43 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 4058, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
if (PyDict_SetItem(__pyx_t_43, __pyx_n_s_gen, __pyx_n_s_mus_any) < 0) __PYX_ERR(0, 4058, __pyx_L1_error)
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_415is_all_pass, 0, __pyx_n_s_is_all_pass, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__486)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 4058, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
__Pyx_CyFunction_SetAnnotationsDict(__pyx_t_40, __pyx_t_43);
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
if (PyDict_SetItem(__pyx_d, __pyx_n_s_is_all_pass, __pyx_t_40) < 0) __PYX_ERR(0, 4058, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
/* … */
__pyx_codeobj__486 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__56, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_is_all_pass, 4058, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__486)) __PYX_ERR(0, 4058, __pyx_L1_error)
4059: """
4060: returns True if gen is a all_pass.
4061:
4062: :param gen: gen
4063: :rtype: bool
4064: """
+4065: return cclm.mus_is_all_pass(gen._ptr)
__Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyBool_FromLong(mus_is_all_pass(__pyx_v_gen->_ptr)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4065, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
4066:
4067:
4068: # ---------------- all-pass-bank ---------------- #
+4069: cpdef mus_any make_all_pass_bank(all_passes: list):
static PyObject *__pyx_pw_8pysndlib_3clm_417make_all_pass_bank(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_f_8pysndlib_3clm_make_all_pass_bank(PyObject *__pyx_v_all_passes, CYTHON_UNUSED int __pyx_skip_dispatch) {
PyObject *__pyx_v_p = NULL;
struct __pyx_obj_8pysndlib_3clm_mus_any_array *__pyx_v_all_passes_array = NULL;
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = NULL;
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_r = NULL;
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("pysndlib.clm.make_all_pass_bank", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XDECREF(__pyx_v_p);
__Pyx_XDECREF((PyObject *)__pyx_v_all_passes_array);
__Pyx_XDECREF((PyObject *)__pyx_v_gen);
__Pyx_XGIVEREF((PyObject *)__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_417make_all_pass_bank(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_416make_all_pass_bank, "\n return a new all_pass-bank generator.\n \n :param all_passes: list of all_pass gens\n :return: all_pass_bank gen\n :rtype: mus_any\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_417make_all_pass_bank = {"make_all_pass_bank", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_417make_all_pass_bank, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_416make_all_pass_bank};
static PyObject *__pyx_pw_8pysndlib_3clm_417make_all_pass_bank(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
PyObject *__pyx_v_all_passes = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("make_all_pass_bank (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_all_passes,0};
PyObject* values[1] = {0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_all_passes)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4069, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "make_all_pass_bank") < 0)) __PYX_ERR(0, 4069, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 1)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
}
__pyx_v_all_passes = ((PyObject*)values[0]);
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("make_all_pass_bank", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 4069, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.make_all_pass_bank", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_all_passes), (&PyList_Type), 0, "all_passes", 1))) __PYX_ERR(0, 4069, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_416make_all_pass_bank(__pyx_self, __pyx_v_all_passes);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_416make_all_pass_bank(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_all_passes) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = ((PyObject *)__pyx_f_8pysndlib_3clm_make_all_pass_bank(__pyx_v_all_passes, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4069, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("pysndlib.clm.make_all_pass_bank", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_tuple__487 = PyTuple_Pack(1, __pyx_n_s_all_passes); if (unlikely(!__pyx_tuple__487)) __PYX_ERR(0, 4069, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__487);
__Pyx_GIVEREF(__pyx_tuple__487);
/* … */
__pyx_t_40 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 4069, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
if (PyDict_SetItem(__pyx_t_40, __pyx_n_s_all_passes, __pyx_n_s_list) < 0) __PYX_ERR(0, 4069, __pyx_L1_error)
__pyx_t_43 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_417make_all_pass_bank, 0, __pyx_n_s_make_all_pass_bank, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__488)); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 4069, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
__Pyx_CyFunction_SetAnnotationsDict(__pyx_t_43, __pyx_t_40);
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
if (PyDict_SetItem(__pyx_d, __pyx_n_s_make_all_pass_bank, __pyx_t_43) < 0) __PYX_ERR(0, 4069, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
__pyx_codeobj__488 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__487, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_make_all_pass_bank, 4069, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__488)) __PYX_ERR(0, 4069, __pyx_L1_error)
4070: """
4071: return a new all_pass-bank generator.
4072:
4073: :param all_passes: list of all_pass gens
4074: :return: all_pass_bank gen
4075: :rtype: mus_any
4076: """
+4077: p = list(map(is_all_pass, all_passes))
__Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_is_all_pass); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4077, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4077, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_GIVEREF(__pyx_t_1); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1)) __PYX_ERR(0, 4077, __pyx_L1_error); __Pyx_INCREF(__pyx_v_all_passes); __Pyx_GIVEREF(__pyx_v_all_passes); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_all_passes)) __PYX_ERR(0, 4077, __pyx_L1_error); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_map, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4077, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_PySequence_ListKeepNew(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4077, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_p = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0;
+4078: if not all(p):
__pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_all, __pyx_v_p); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4078, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 4078, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_4 = (!__pyx_t_3); if (unlikely(__pyx_t_4)) { /* … */ }
+4079: raise TypeError(f'allpass list contains at least one element that is not a all_pass.')
__pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__49, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4079, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __PYX_ERR(0, 4079, __pyx_L1_error) /* … */ __pyx_tuple__49 = PyTuple_Pack(1, __pyx_kp_u_allpass_list_contains_at_least_o); if (unlikely(!__pyx_tuple__49)) __PYX_ERR(0, 4079, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__49); __Pyx_GIVEREF(__pyx_tuple__49);
4080:
+4081: all_passes_array = mus_any_array.from_pylist(all_passes)
__pyx_t_2 = ((PyObject *)__pyx_f_8pysndlib_3clm_13mus_any_array_from_pylist(__pyx_v_all_passes)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4081, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_v_all_passes_array = ((struct __pyx_obj_8pysndlib_3clm_mus_any_array *)__pyx_t_2); __pyx_t_2 = 0;
+4082: gen = mus_any.from_ptr(cclm.mus_make_all_pass_bank(len(all_passes), all_passes_array.data))
__pyx_t_5 = __Pyx_PyList_GET_SIZE(__pyx_v_all_passes); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(0, 4082, __pyx_L1_error) __pyx_t_2 = ((PyObject *)__pyx_vtabptr_8pysndlib_3clm_mus_any->from_ptr(mus_make_all_pass_bank(__pyx_t_5, __pyx_v_all_passes_array->data), NULL)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4082, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_t_2); __pyx_t_2 = 0;
+4083: gen.cache_extend([all_passes_array, all_passes])
__pyx_t_2 = PyList_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4083, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF((PyObject *)__pyx_v_all_passes_array); __Pyx_GIVEREF((PyObject *)__pyx_v_all_passes_array); if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_all_passes_array))) __PYX_ERR(0, 4083, __pyx_L1_error); __Pyx_INCREF(__pyx_v_all_passes); __Pyx_GIVEREF(__pyx_v_all_passes); if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 1, __pyx_v_all_passes)) __PYX_ERR(0, 4083, __pyx_L1_error); __pyx_t_1 = ((struct __pyx_vtabstruct_8pysndlib_3clm_mus_any *)__pyx_v_gen->__pyx_vtab)->cache_extend(__pyx_v_gen, __pyx_t_2, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4083, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+4084: return gen
__Pyx_XDECREF((PyObject *)__pyx_r); __Pyx_INCREF((PyObject *)__pyx_v_gen); __pyx_r = __pyx_v_gen; goto __pyx_L0;
4085:
+4086: cpdef cython.double all_pass_bank(gen: mus_any, insig: float):
static PyObject *__pyx_pw_8pysndlib_3clm_419all_pass_bank(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static double __pyx_f_8pysndlib_3clm_all_pass_bank(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, double __pyx_v_insig, CYTHON_UNUSED int __pyx_skip_dispatch) {
double __pyx_r;
/* … */
/* function exit code */
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_419all_pass_bank(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_418all_pass_bank, "\n sum an array of all_pass filters.\n \n :param gen: all_pass_bank gen\n :param inputs: can be a list/array of inputs or a single input\n :rtype: float\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_419all_pass_bank = {"all_pass_bank", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_419all_pass_bank, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_418all_pass_bank};
static PyObject *__pyx_pw_8pysndlib_3clm_419all_pass_bank(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = 0;
double __pyx_v_insig;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("all_pass_bank (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gen,&__pyx_n_s_insig,0};
PyObject* values[2] = {0,0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_gen)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4086, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_insig)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4086, __pyx_L3_error)
else {
__Pyx_RaiseArgtupleInvalid("all_pass_bank", 1, 2, 2, 1); __PYX_ERR(0, 4086, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "all_pass_bank") < 0)) __PYX_ERR(0, 4086, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 2)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
}
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)values[0]);
__pyx_v_insig = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_insig == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 4086, __pyx_L3_error)
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("all_pass_bank", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 4086, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.all_pass_bank", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gen), __pyx_ptype_8pysndlib_3clm_mus_any, 0, "gen", 0))) __PYX_ERR(0, 4086, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_418all_pass_bank(__pyx_self, __pyx_v_gen, __pyx_v_insig);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_418all_pass_bank(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, double __pyx_v_insig) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8pysndlib_3clm_all_pass_bank(__pyx_v_gen, __pyx_v_insig, 0); if (unlikely(__pyx_t_1 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 4086, __pyx_L1_error)
__pyx_t_2 = PyFloat_FromDouble(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4086, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("pysndlib.clm.all_pass_bank", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_43 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 4086, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
if (PyDict_SetItem(__pyx_t_43, __pyx_n_s_gen, __pyx_n_s_mus_any) < 0) __PYX_ERR(0, 4086, __pyx_L1_error)
if (PyDict_SetItem(__pyx_t_43, __pyx_n_s_insig, __pyx_n_s_float) < 0) __PYX_ERR(0, 4086, __pyx_L1_error)
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_419all_pass_bank, 0, __pyx_n_s_all_pass_bank, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__489)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 4086, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
__Pyx_CyFunction_SetAnnotationsDict(__pyx_t_40, __pyx_t_43);
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
if (PyDict_SetItem(__pyx_d, __pyx_n_s_all_pass_bank, __pyx_t_40) < 0) __PYX_ERR(0, 4086, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
/* … */
__pyx_codeobj__489 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__380, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_all_pass_bank, 4086, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__489)) __PYX_ERR(0, 4086, __pyx_L1_error)
4087: """
4088: sum an array of all_pass filters.
4089:
4090: :param gen: all_pass_bank gen
4091: :param inputs: can be a list/array of inputs or a single input
4092: :rtype: float
4093: """
+4094: return cclm.mus_all_pass_bank(gen._ptr, insig)
__pyx_r = mus_all_pass_bank(__pyx_v_gen->_ptr, __pyx_v_insig); goto __pyx_L0;
4095:
+4096: cpdef bint is_all_pass_bank(gen: mus_any):
static PyObject *__pyx_pw_8pysndlib_3clm_421is_all_pass_bank(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static int __pyx_f_8pysndlib_3clm_is_all_pass_bank(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, CYTHON_UNUSED int __pyx_skip_dispatch) {
int __pyx_r;
/* … */
/* function exit code */
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_421is_all_pass_bank(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_420is_all_pass_bank, "\n returns True if gen is a all_pass_bank.\n \n \n :param gen: gen\n :rtype: bool\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_421is_all_pass_bank = {"is_all_pass_bank", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_421is_all_pass_bank, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_420is_all_pass_bank};
static PyObject *__pyx_pw_8pysndlib_3clm_421is_all_pass_bank(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("is_all_pass_bank (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gen,0};
PyObject* values[1] = {0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_gen)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4096, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "is_all_pass_bank") < 0)) __PYX_ERR(0, 4096, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 1)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
}
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)values[0]);
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("is_all_pass_bank", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 4096, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.is_all_pass_bank", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gen), __pyx_ptype_8pysndlib_3clm_mus_any, 0, "gen", 0))) __PYX_ERR(0, 4096, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_420is_all_pass_bank(__pyx_self, __pyx_v_gen);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_420is_all_pass_bank(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8pysndlib_3clm_is_all_pass_bank(__pyx_v_gen, 0); if (unlikely(__pyx_t_1 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 4096, __pyx_L1_error)
__pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4096, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("pysndlib.clm.is_all_pass_bank", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_40 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 4096, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
if (PyDict_SetItem(__pyx_t_40, __pyx_n_s_gen, __pyx_n_s_mus_any) < 0) __PYX_ERR(0, 4096, __pyx_L1_error)
__pyx_t_43 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_421is_all_pass_bank, 0, __pyx_n_s_is_all_pass_bank, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__490)); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 4096, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
__Pyx_CyFunction_SetAnnotationsDict(__pyx_t_43, __pyx_t_40);
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
if (PyDict_SetItem(__pyx_d, __pyx_n_s_is_all_pass_bank, __pyx_t_43) < 0) __PYX_ERR(0, 4096, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
/* … */
__pyx_codeobj__490 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__56, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_is_all_pass_bank, 4096, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__490)) __PYX_ERR(0, 4096, __pyx_L1_error)
4097: """
4098: returns True if gen is a all_pass_bank.
4099:
4100:
4101: :param gen: gen
4102: :rtype: bool
4103: """
+4104: return cclm.mus_is_all_pass_bank(gen._ptr)
__pyx_r = mus_is_all_pass_bank(__pyx_v_gen->_ptr); goto __pyx_L0;
4105:
4106:
4107: # ---------------- one_pole_all_pass ---------------- #
+4108: cpdef mus_any make_one_pole_all_pass(size: int, coeff: float):
static PyObject *__pyx_pw_8pysndlib_3clm_423make_one_pole_all_pass(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_f_8pysndlib_3clm_make_one_pole_all_pass(PyObject *__pyx_v_size, double __pyx_v_coeff, CYTHON_UNUSED int __pyx_skip_dispatch) {
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_r = NULL;
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("pysndlib.clm.make_one_pole_all_pass", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XGIVEREF((PyObject *)__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_423make_one_pole_all_pass(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_422make_one_pole_all_pass, "\n return a new one_pole all_pass filter size, coeff.\n \n \n :param size: length \\in samples of the delay line\n :param coeff: coeff of one pole filter\n :return: one_pole_all_pass gen\n :rtype: mus_any\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_423make_one_pole_all_pass = {"make_one_pole_all_pass", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_423make_one_pole_all_pass, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_422make_one_pole_all_pass};
static PyObject *__pyx_pw_8pysndlib_3clm_423make_one_pole_all_pass(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
PyObject *__pyx_v_size = 0;
double __pyx_v_coeff;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("make_one_pole_all_pass (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_size,&__pyx_n_s_coeff,0};
PyObject* values[2] = {0,0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_size)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4108, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_coeff)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4108, __pyx_L3_error)
else {
__Pyx_RaiseArgtupleInvalid("make_one_pole_all_pass", 1, 2, 2, 1); __PYX_ERR(0, 4108, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "make_one_pole_all_pass") < 0)) __PYX_ERR(0, 4108, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 2)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
}
__pyx_v_size = ((PyObject*)values[0]);
__pyx_v_coeff = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_coeff == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 4108, __pyx_L3_error)
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("make_one_pole_all_pass", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 4108, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.make_one_pole_all_pass", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_size), (&PyInt_Type), 0, "size", 1))) __PYX_ERR(0, 4108, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_422make_one_pole_all_pass(__pyx_self, __pyx_v_size, __pyx_v_coeff);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_422make_one_pole_all_pass(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_size, double __pyx_v_coeff) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = ((PyObject *)__pyx_f_8pysndlib_3clm_make_one_pole_all_pass(__pyx_v_size, __pyx_v_coeff, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4108, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("pysndlib.clm.make_one_pole_all_pass", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_tuple__491 = PyTuple_Pack(2, __pyx_n_s_size, __pyx_n_s_coeff); if (unlikely(!__pyx_tuple__491)) __PYX_ERR(0, 4108, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__491);
__Pyx_GIVEREF(__pyx_tuple__491);
/* … */
__pyx_t_43 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 4108, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
if (PyDict_SetItem(__pyx_t_43, __pyx_n_s_size, __pyx_n_s_int_2) < 0) __PYX_ERR(0, 4108, __pyx_L1_error)
if (PyDict_SetItem(__pyx_t_43, __pyx_n_s_coeff, __pyx_n_s_float) < 0) __PYX_ERR(0, 4108, __pyx_L1_error)
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_423make_one_pole_all_pass, 0, __pyx_n_s_make_one_pole_all_pass, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__492)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 4108, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
__Pyx_CyFunction_SetAnnotationsDict(__pyx_t_40, __pyx_t_43);
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
if (PyDict_SetItem(__pyx_d, __pyx_n_s_make_one_pole_all_pass, __pyx_t_40) < 0) __PYX_ERR(0, 4108, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
__pyx_codeobj__492 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__491, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_make_one_pole_all_pass, 4108, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__492)) __PYX_ERR(0, 4108, __pyx_L1_error)
4109: """
4110: return a new one_pole all_pass filter size, coeff.
4111:
4112:
4113: :param size: length \in samples of the delay line
4114: :param coeff: coeff of one pole filter
4115: :return: one_pole_all_pass gen
4116: :rtype: mus_any
4117: """
+4118: return mus_any.from_ptr(cclm.mus_make_one_pole_all_pass(size, coeff))
__Pyx_XDECREF((PyObject *)__pyx_r); __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_size); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 4118, __pyx_L1_error) __pyx_t_2 = ((PyObject *)__pyx_vtabptr_8pysndlib_3clm_mus_any->from_ptr(mus_make_one_pole_all_pass(__pyx_t_1, __pyx_v_coeff), NULL)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4118, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_r = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_t_2); __pyx_t_2 = 0; goto __pyx_L0;
4119:
+4120: cpdef cython.double one_pole_all_pass(gen: mus_any, insig: float):
static PyObject *__pyx_pw_8pysndlib_3clm_425one_pole_all_pass(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static double __pyx_f_8pysndlib_3clm_one_pole_all_pass(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, double __pyx_v_insig, CYTHON_UNUSED int __pyx_skip_dispatch) {
double __pyx_r;
/* … */
/* function exit code */
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_425one_pole_all_pass(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_424one_pole_all_pass, "\n one pole all pass filter of input.\n \n :param gen: one_pole_all_pass gen\n :param insig: input value\n :rtype: float\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_425one_pole_all_pass = {"one_pole_all_pass", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_425one_pole_all_pass, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_424one_pole_all_pass};
static PyObject *__pyx_pw_8pysndlib_3clm_425one_pole_all_pass(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = 0;
double __pyx_v_insig;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("one_pole_all_pass (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gen,&__pyx_n_s_insig,0};
PyObject* values[2] = {0,0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_gen)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4120, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_insig)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4120, __pyx_L3_error)
else {
__Pyx_RaiseArgtupleInvalid("one_pole_all_pass", 1, 2, 2, 1); __PYX_ERR(0, 4120, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "one_pole_all_pass") < 0)) __PYX_ERR(0, 4120, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 2)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
}
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)values[0]);
__pyx_v_insig = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_insig == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 4120, __pyx_L3_error)
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("one_pole_all_pass", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 4120, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.one_pole_all_pass", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gen), __pyx_ptype_8pysndlib_3clm_mus_any, 0, "gen", 0))) __PYX_ERR(0, 4120, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_424one_pole_all_pass(__pyx_self, __pyx_v_gen, __pyx_v_insig);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_424one_pole_all_pass(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, double __pyx_v_insig) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8pysndlib_3clm_one_pole_all_pass(__pyx_v_gen, __pyx_v_insig, 0); if (unlikely(__pyx_t_1 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 4120, __pyx_L1_error)
__pyx_t_2 = PyFloat_FromDouble(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4120, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("pysndlib.clm.one_pole_all_pass", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_40 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 4120, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
if (PyDict_SetItem(__pyx_t_40, __pyx_n_s_gen, __pyx_n_s_mus_any) < 0) __PYX_ERR(0, 4120, __pyx_L1_error)
if (PyDict_SetItem(__pyx_t_40, __pyx_n_s_insig, __pyx_n_s_float) < 0) __PYX_ERR(0, 4120, __pyx_L1_error)
__pyx_t_43 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_425one_pole_all_pass, 0, __pyx_n_s_one_pole_all_pass, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__493)); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 4120, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
__Pyx_CyFunction_SetAnnotationsDict(__pyx_t_43, __pyx_t_40);
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
if (PyDict_SetItem(__pyx_d, __pyx_n_s_one_pole_all_pass, __pyx_t_43) < 0) __PYX_ERR(0, 4120, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
/* … */
__pyx_codeobj__493 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__380, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_one_pole_all_pass, 4120, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__493)) __PYX_ERR(0, 4120, __pyx_L1_error)
4121: """
4122: one pole all pass filter of input.
4123:
4124: :param gen: one_pole_all_pass gen
4125: :param insig: input value
4126: :rtype: float
4127: """
+4128: return cclm.mus_one_pole_all_pass(gen._ptr, insig)
__pyx_r = mus_one_pole_all_pass(__pyx_v_gen->_ptr, __pyx_v_insig); goto __pyx_L0;
4129:
+4130: cpdef bint is_one_pole_all_pass(gen: mus_any):
static PyObject *__pyx_pw_8pysndlib_3clm_427is_one_pole_all_pass(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static int __pyx_f_8pysndlib_3clm_is_one_pole_all_pass(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, CYTHON_UNUSED int __pyx_skip_dispatch) {
int __pyx_r;
/* … */
/* function exit code */
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_427is_one_pole_all_pass(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_426is_one_pole_all_pass, "\n returns True if gen is a one_pole_all_pass.\n \n :param gen: gen\n :rtype: bool\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_427is_one_pole_all_pass = {"is_one_pole_all_pass", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_427is_one_pole_all_pass, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_426is_one_pole_all_pass};
static PyObject *__pyx_pw_8pysndlib_3clm_427is_one_pole_all_pass(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("is_one_pole_all_pass (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gen,0};
PyObject* values[1] = {0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_gen)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4130, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "is_one_pole_all_pass") < 0)) __PYX_ERR(0, 4130, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 1)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
}
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)values[0]);
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("is_one_pole_all_pass", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 4130, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.is_one_pole_all_pass", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gen), __pyx_ptype_8pysndlib_3clm_mus_any, 0, "gen", 0))) __PYX_ERR(0, 4130, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_426is_one_pole_all_pass(__pyx_self, __pyx_v_gen);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_426is_one_pole_all_pass(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8pysndlib_3clm_is_one_pole_all_pass(__pyx_v_gen, 0); if (unlikely(__pyx_t_1 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 4130, __pyx_L1_error)
__pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4130, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("pysndlib.clm.is_one_pole_all_pass", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_43 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 4130, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
if (PyDict_SetItem(__pyx_t_43, __pyx_n_s_gen, __pyx_n_s_mus_any) < 0) __PYX_ERR(0, 4130, __pyx_L1_error)
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_427is_one_pole_all_pass, 0, __pyx_n_s_is_one_pole_all_pass, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__494)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 4130, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
__Pyx_CyFunction_SetAnnotationsDict(__pyx_t_40, __pyx_t_43);
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
if (PyDict_SetItem(__pyx_d, __pyx_n_s_is_one_pole_all_pass, __pyx_t_40) < 0) __PYX_ERR(0, 4130, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
/* … */
__pyx_codeobj__494 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__56, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_is_one_pole_all_pass, 4130, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__494)) __PYX_ERR(0, 4130, __pyx_L1_error)
4131: """
4132: returns True if gen is a one_pole_all_pass.
4133:
4134: :param gen: gen
4135: :rtype: bool
4136: """
+4137: return cclm.mus_is_one_pole_all_pass(gen._ptr)
__pyx_r = mus_is_one_pole_all_pass(__pyx_v_gen->_ptr); goto __pyx_L0;
4138:
4139: # ---------------- moving-average ---------------- #
+4140: cpdef mus_any make_moving_average(size: int, initial_contents=None, initial_element: Optional[float]=0.0):
static PyObject *__pyx_pw_8pysndlib_3clm_429make_moving_average(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_f_8pysndlib_3clm_make_moving_average(PyObject *__pyx_v_size, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_8pysndlib_3clm_make_moving_average *__pyx_optional_args) {
PyObject *__pyx_v_initial_contents = ((PyObject *)Py_None);
PyObject *__pyx_v_initial_element = ((PyObject *)__pyx_float_0_0);
__Pyx_memviewslice __pyx_v_initial_contents_view = { 0, 0, { 0 }, { 0 }, { 0 } };
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = NULL;
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_r = NULL;
if (__pyx_optional_args) {
if (__pyx_optional_args->__pyx_n > 0) {
__pyx_v_initial_contents = __pyx_optional_args->initial_contents;
if (__pyx_optional_args->__pyx_n > 1) {
__pyx_v_initial_element = __pyx_optional_args->initial_element;
}
}
}
__Pyx_INCREF(__pyx_v_initial_contents);
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__PYX_XCLEAR_MEMVIEW(&__pyx_t_3, 1);
__Pyx_XDECREF(__pyx_t_5);
__Pyx_XDECREF(__pyx_t_6);
__Pyx_XDECREF(__pyx_t_8);
__Pyx_XDECREF(__pyx_t_9);
__Pyx_AddTraceback("pysndlib.clm.make_moving_average", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__PYX_XCLEAR_MEMVIEW(&__pyx_v_initial_contents_view, 1);
__Pyx_XDECREF((PyObject *)__pyx_v_gen);
__Pyx_XDECREF(__pyx_v_initial_contents);
__Pyx_XGIVEREF((PyObject *)__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_429make_moving_average(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_428make_moving_average, "\n return a new moving_average generator. \n \n :param size: averaging length \\in samples\n :param initial_contents: initial values\n :param initial_element: initial element\n :return: moving_average gen\n :rtype: mus_any\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_429make_moving_average = {"make_moving_average", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_429make_moving_average, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_428make_moving_average};
static PyObject *__pyx_pw_8pysndlib_3clm_429make_moving_average(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
PyObject *__pyx_v_size = 0;
PyObject *__pyx_v_initial_contents = 0;
PyObject *__pyx_v_initial_element = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("make_moving_average (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_size,&__pyx_n_s_initial_contents,&__pyx_n_s_initial_element,0};
PyObject* values[3] = {0,0,0};
values[1] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
values[2] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)__pyx_float_0_0));
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_size)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4140, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_initial_contents);
if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4140, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 2:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_initial_element);
if (value) { values[2] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4140, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "make_moving_average") < 0)) __PYX_ERR(0, 4140, __pyx_L3_error)
}
} else {
switch (__pyx_nargs) {
case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
break;
default: goto __pyx_L5_argtuple_error;
}
}
__pyx_v_size = ((PyObject*)values[0]);
__pyx_v_initial_contents = values[1];
__pyx_v_initial_element = values[2];
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("make_moving_average", 0, 1, 3, __pyx_nargs); __PYX_ERR(0, 4140, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.make_moving_average", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_size), (&PyInt_Type), 0, "size", 1))) __PYX_ERR(0, 4140, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_428make_moving_average(__pyx_self, __pyx_v_size, __pyx_v_initial_contents, __pyx_v_initial_element);
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_428make_moving_average(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_size, PyObject *__pyx_v_initial_contents, PyObject *__pyx_v_initial_element) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_2.__pyx_n = 2;
__pyx_t_2.initial_contents = __pyx_v_initial_contents;
__pyx_t_2.initial_element = __pyx_v_initial_element;
__pyx_t_1 = ((PyObject *)__pyx_f_8pysndlib_3clm_make_moving_average(__pyx_v_size, 0, &__pyx_t_2)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4140, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("pysndlib.clm.make_moving_average", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_tuple__495 = PyTuple_Pack(3, __pyx_n_s_size, __pyx_n_s_initial_contents, __pyx_n_s_initial_element); if (unlikely(!__pyx_tuple__495)) __PYX_ERR(0, 4140, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__495);
__Pyx_GIVEREF(__pyx_tuple__495);
__pyx_codeobj__496 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__495, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_make_moving_average, 4140, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__496)) __PYX_ERR(0, 4140, __pyx_L1_error)
/* … */
__pyx_t_40 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 4140, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
if (PyDict_SetItem(__pyx_t_40, __pyx_n_s_size, __pyx_n_s_int_2) < 0) __PYX_ERR(0, 4140, __pyx_L1_error)
if (PyDict_SetItem(__pyx_t_40, __pyx_n_s_initial_element, __pyx_kp_s_Optional_float) < 0) __PYX_ERR(0, 4140, __pyx_L1_error)
__pyx_t_43 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_429make_moving_average, 0, __pyx_n_s_make_moving_average, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__496)); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 4140, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
__Pyx_CyFunction_SetDefaultsTuple(__pyx_t_43, __pyx_tuple__497);
__Pyx_CyFunction_SetAnnotationsDict(__pyx_t_43, __pyx_t_40);
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
if (PyDict_SetItem(__pyx_d, __pyx_n_s_make_moving_average, __pyx_t_43) < 0) __PYX_ERR(0, 4140, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
__pyx_tuple__497 = PyTuple_Pack(2, Py_None, __pyx_float_0_0); if (unlikely(!__pyx_tuple__497)) __PYX_ERR(0, 4140, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__497);
__Pyx_GIVEREF(__pyx_tuple__497);
/* … */
struct __pyx_opt_args_8pysndlib_3clm_make_moving_average {
int __pyx_n;
PyObject *initial_contents;
PyObject *initial_element;
};
4141: """
4142: return a new moving_average generator.
4143:
4144: :param size: averaging length \in samples
4145: :param initial_contents: initial values
4146: :param initial_element: initial element
4147: :return: moving_average gen
4148: :rtype: mus_any
4149: """
4150:
+4151: check_range('size', size, 0.0, None)
__pyx_t_2.__pyx_n = 2; __pyx_t_2.low = __pyx_float_0_0; __pyx_t_2.high = Py_None; __pyx_t_1 = __pyx_f_8pysndlib_3clm_check_range(__pyx_n_s_size, __pyx_v_size, 0, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4151, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4152:
+4153: cdef double [:] initial_contents_view = None
__pyx_t_3 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(Py_None, PyBUF_WRITABLE); if (unlikely(!__pyx_t_3.memview)) __PYX_ERR(0, 4153, __pyx_L1_error) __pyx_v_initial_contents_view = __pyx_t_3; __pyx_t_3.memview = NULL; __pyx_t_3.data = NULL;
4154:
+4155: if initial_contents is not None:
__pyx_t_4 = (__pyx_v_initial_contents != Py_None);
if (__pyx_t_4) {
/* … */
goto __pyx_L3;
}
+4156: if isinstance(initial_contents, list):
__pyx_t_4 = PyList_Check(__pyx_v_initial_contents);
if (__pyx_t_4) {
/* … */
}
+4157: initial_contents = np.array(initial_contents)
__Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4157, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_array); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 4157, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_5 = NULL; __pyx_t_7 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_6))) { __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6); if (likely(__pyx_t_5)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); __Pyx_INCREF(__pyx_t_5); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_6, function); __pyx_t_7 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_v_initial_contents}; __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7); __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4157, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; } __Pyx_DECREF_SET(__pyx_v_initial_contents, __pyx_t_1); __pyx_t_1 = 0;
+4158: check_ndim(initial_contents)
__pyx_t_1 = __pyx_f_8pysndlib_3clm_check_ndim(__pyx_v_initial_contents, 0, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4158, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+4159: initial_contents_view = initial_contents
__pyx_t_3 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_v_initial_contents, PyBUF_WRITABLE); if (unlikely(!__pyx_t_3.memview)) __PYX_ERR(0, 4159, __pyx_L1_error) __PYX_XCLEAR_MEMVIEW(&__pyx_v_initial_contents_view, 1); __pyx_v_initial_contents_view = __pyx_t_3; __pyx_t_3.memview = NULL; __pyx_t_3.data = NULL;
4160: else:
+4161: initial_contents = np.zeros(size, dtype=np.double)
/*else*/ {
__Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4161, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_zeros); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 4161, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_6);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4161, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__Pyx_INCREF(__pyx_v_size);
__Pyx_GIVEREF(__pyx_v_size);
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_size)) __PYX_ERR(0, 4161, __pyx_L1_error);
__pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4161, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_5);
__Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 4161, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_8);
__pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_double); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 4161, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_9);
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_dtype, __pyx_t_9) < 0) __PYX_ERR(0, 4161, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
__pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_1, __pyx_t_5); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 4161, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_9);
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_DECREF_SET(__pyx_v_initial_contents, __pyx_t_9);
__pyx_t_9 = 0;
+4162: check_ndim(initial_contents)
__pyx_t_9 = __pyx_f_8pysndlib_3clm_check_ndim(__pyx_v_initial_contents, 0, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 4162, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+4163: initial_contents.fill(initial_element)
__pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_initial_contents, __pyx_n_s_fill); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4163, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_1 = NULL; __pyx_t_7 = 0; #if CYTHON_UNPACK_METHODS if (likely(PyMethod_Check(__pyx_t_5))) { __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_5); if (likely(__pyx_t_1)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); __Pyx_INCREF(__pyx_t_1); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_5, function); __pyx_t_7 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_v_initial_element}; __pyx_t_9 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7); __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 4163, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+4164: initial_contents_view = initial_contents
__pyx_t_3 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_v_initial_contents, PyBUF_WRITABLE); if (unlikely(!__pyx_t_3.memview)) __PYX_ERR(0, 4164, __pyx_L1_error) __PYX_XCLEAR_MEMVIEW(&__pyx_v_initial_contents_view, 1); __pyx_v_initial_contents_view = __pyx_t_3; __pyx_t_3.memview = NULL; __pyx_t_3.data = NULL; } __pyx_L3:;
4165:
+4166: if initial_contents_view is not None:
__pyx_t_4 = (((PyObject *) __pyx_v_initial_contents_view.memview) != Py_None);
if (__pyx_t_4) {
/* … */
}
+4167: gen = mus_any.from_ptr(cclm.mus_make_moving_average(size, &initial_contents_view[0]))
__pyx_t_7 = __Pyx_PyInt_As_int(__pyx_v_size); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 4167, __pyx_L1_error) __pyx_t_10 = 0; __pyx_t_11 = -1; if (__pyx_t_10 < 0) { __pyx_t_10 += __pyx_v_initial_contents_view.shape[0]; if (unlikely(__pyx_t_10 < 0)) __pyx_t_11 = 0; } else if (unlikely(__pyx_t_10 >= __pyx_v_initial_contents_view.shape[0])) __pyx_t_11 = 0; if (unlikely(__pyx_t_11 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_11); __PYX_ERR(0, 4167, __pyx_L1_error) } __pyx_t_9 = ((PyObject *)__pyx_vtabptr_8pysndlib_3clm_mus_any->from_ptr(mus_make_moving_average(__pyx_t_7, (&(*((double *) ( /* dim=0 */ (__pyx_v_initial_contents_view.data + __pyx_t_10 * __pyx_v_initial_contents_view.strides[0]) ))))), NULL)); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 4167, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_t_9); __pyx_t_9 = 0;
4168:
+4169: gen.cache_append(initial_contents)
if (unlikely(!__pyx_v_gen)) { __Pyx_RaiseUnboundLocalError("gen"); __PYX_ERR(0, 4169, __pyx_L1_error) }
__pyx_t_9 = ((struct __pyx_vtabstruct_8pysndlib_3clm_mus_any *)__pyx_v_gen->__pyx_vtab)->cache_append(__pyx_v_gen, __pyx_v_initial_contents, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 4169, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_9);
__Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+4170: return gen
__Pyx_XDECREF((PyObject *)__pyx_r); if (unlikely(!__pyx_v_gen)) { __Pyx_RaiseUnboundLocalError("gen"); __PYX_ERR(0, 4170, __pyx_L1_error) } __Pyx_INCREF((PyObject *)__pyx_v_gen); __pyx_r = __pyx_v_gen; goto __pyx_L0;
4171:
4172:
+4173: cpdef cython.double moving_average(gen: mus_any, insig: float):
static PyObject *__pyx_pw_8pysndlib_3clm_431moving_average(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static double __pyx_f_8pysndlib_3clm_moving_average(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, double __pyx_v_insig, CYTHON_UNUSED int __pyx_skip_dispatch) {
double __pyx_r;
/* … */
/* function exit code */
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_431moving_average(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_430moving_average, "\n moving window average.\n \n :param gen: moving_average gen\n :param insig: input value\n :rtype: float\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_431moving_average = {"moving_average", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_431moving_average, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_430moving_average};
static PyObject *__pyx_pw_8pysndlib_3clm_431moving_average(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = 0;
double __pyx_v_insig;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("moving_average (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gen,&__pyx_n_s_insig,0};
PyObject* values[2] = {0,0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_gen)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4173, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_insig)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4173, __pyx_L3_error)
else {
__Pyx_RaiseArgtupleInvalid("moving_average", 1, 2, 2, 1); __PYX_ERR(0, 4173, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "moving_average") < 0)) __PYX_ERR(0, 4173, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 2)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
}
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)values[0]);
__pyx_v_insig = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_insig == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 4173, __pyx_L3_error)
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("moving_average", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 4173, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.moving_average", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gen), __pyx_ptype_8pysndlib_3clm_mus_any, 0, "gen", 0))) __PYX_ERR(0, 4173, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_430moving_average(__pyx_self, __pyx_v_gen, __pyx_v_insig);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_430moving_average(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, double __pyx_v_insig) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8pysndlib_3clm_moving_average(__pyx_v_gen, __pyx_v_insig, 0); if (unlikely(__pyx_t_1 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 4173, __pyx_L1_error)
__pyx_t_2 = PyFloat_FromDouble(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4173, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("pysndlib.clm.moving_average", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_43 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 4173, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
if (PyDict_SetItem(__pyx_t_43, __pyx_n_s_gen, __pyx_n_s_mus_any) < 0) __PYX_ERR(0, 4173, __pyx_L1_error)
if (PyDict_SetItem(__pyx_t_43, __pyx_n_s_insig, __pyx_n_s_float) < 0) __PYX_ERR(0, 4173, __pyx_L1_error)
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_431moving_average, 0, __pyx_n_s_moving_average, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__498)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 4173, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
__Pyx_CyFunction_SetAnnotationsDict(__pyx_t_40, __pyx_t_43);
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
if (PyDict_SetItem(__pyx_d, __pyx_n_s_moving_average, __pyx_t_40) < 0) __PYX_ERR(0, 4173, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
/* … */
__pyx_codeobj__498 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__380, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_moving_average, 4173, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__498)) __PYX_ERR(0, 4173, __pyx_L1_error)
4174: """
4175: moving window average.
4176:
4177: :param gen: moving_average gen
4178: :param insig: input value
4179: :rtype: float
4180: """
+4181: return cclm.mus_moving_average(gen._ptr, insig)
__pyx_r = mus_moving_average(__pyx_v_gen->_ptr, __pyx_v_insig); goto __pyx_L0;
4182:
+4183: cpdef bint is_moving_average(gen: mus_any):
static PyObject *__pyx_pw_8pysndlib_3clm_433is_moving_average(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static int __pyx_f_8pysndlib_3clm_is_moving_average(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, CYTHON_UNUSED int __pyx_skip_dispatch) {
int __pyx_r;
/* … */
/* function exit code */
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_433is_moving_average(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_432is_moving_average, "\n returns True if gen is a moving_average.\n \n :param gen: gen\n :rtype: bool\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_433is_moving_average = {"is_moving_average", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_433is_moving_average, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_432is_moving_average};
static PyObject *__pyx_pw_8pysndlib_3clm_433is_moving_average(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("is_moving_average (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gen,0};
PyObject* values[1] = {0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_gen)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4183, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "is_moving_average") < 0)) __PYX_ERR(0, 4183, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 1)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
}
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)values[0]);
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("is_moving_average", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 4183, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.is_moving_average", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gen), __pyx_ptype_8pysndlib_3clm_mus_any, 0, "gen", 0))) __PYX_ERR(0, 4183, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_432is_moving_average(__pyx_self, __pyx_v_gen);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_432is_moving_average(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8pysndlib_3clm_is_moving_average(__pyx_v_gen, 0); if (unlikely(__pyx_t_1 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 4183, __pyx_L1_error)
__pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4183, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("pysndlib.clm.is_moving_average", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_40 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 4183, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
if (PyDict_SetItem(__pyx_t_40, __pyx_n_s_gen, __pyx_n_s_mus_any) < 0) __PYX_ERR(0, 4183, __pyx_L1_error)
__pyx_t_43 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_433is_moving_average, 0, __pyx_n_s_is_moving_average, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__499)); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 4183, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
__Pyx_CyFunction_SetAnnotationsDict(__pyx_t_43, __pyx_t_40);
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
if (PyDict_SetItem(__pyx_d, __pyx_n_s_is_moving_average, __pyx_t_43) < 0) __PYX_ERR(0, 4183, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
/* … */
__pyx_codeobj__499 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__56, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_is_moving_average, 4183, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__499)) __PYX_ERR(0, 4183, __pyx_L1_error)
4184: """
4185: returns True if gen is a moving_average.
4186:
4187: :param gen: gen
4188: :rtype: bool
4189: """
+4190: return cclm.mus_is_moving_average(gen._ptr)
__pyx_r = mus_is_moving_average(__pyx_v_gen->_ptr); goto __pyx_L0;
4191:
4192: # ---------------- moving-max ---------------- #
+4193: cpdef mus_any make_moving_max(size: int,
static PyObject *__pyx_pw_8pysndlib_3clm_435make_moving_max(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_f_8pysndlib_3clm_make_moving_max(PyObject *__pyx_v_size, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_8pysndlib_3clm_make_moving_max *__pyx_optional_args) {
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__PYX_XCLEAR_MEMVIEW(&__pyx_t_3, 1);
__Pyx_XDECREF(__pyx_t_5);
__Pyx_XDECREF(__pyx_t_6);
__Pyx_XDECREF(__pyx_t_8);
__Pyx_XDECREF(__pyx_t_9);
__Pyx_AddTraceback("pysndlib.clm.make_moving_max", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__PYX_XCLEAR_MEMVIEW(&__pyx_v_initial_contents_view, 1);
__Pyx_XDECREF((PyObject *)__pyx_v_gen);
__Pyx_XDECREF(__pyx_v_initial_contents);
__Pyx_XGIVEREF((PyObject *)__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_435make_moving_max(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_434make_moving_max, "\n return a new moving-max generator.\n \n :param size: max window length \\in samples\n :param initial_contents: initial values\n :param initial_element: initial element\n :return: moving_max gen\n :rtype: mus_any\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_435make_moving_max = {"make_moving_max", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_435make_moving_max, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_434make_moving_max};
static PyObject *__pyx_pw_8pysndlib_3clm_435make_moving_max(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
PyObject *__pyx_v_size = 0;
PyObject *__pyx_v_initial_contents = 0;
PyObject *__pyx_v_initial_element = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("make_moving_max (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_size,&__pyx_n_s_initial_contents,&__pyx_n_s_initial_element,0};
PyObject* values[3] = {0,0,0};
/* … */
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_434make_moving_max(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_size, PyObject *__pyx_v_initial_contents, PyObject *__pyx_v_initial_element) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_2.__pyx_n = 2;
__pyx_t_2.initial_contents = __pyx_v_initial_contents;
__pyx_t_2.initial_element = __pyx_v_initial_element;
__pyx_t_1 = ((PyObject *)__pyx_f_8pysndlib_3clm_make_moving_max(__pyx_v_size, 0, &__pyx_t_2)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4193, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("pysndlib.clm.make_moving_max", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_codeobj__500 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__495, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_make_moving_max, 4193, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__500)) __PYX_ERR(0, 4193, __pyx_L1_error)
/* … */
__pyx_t_43 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 4193, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
if (PyDict_SetItem(__pyx_t_43, __pyx_n_s_size, __pyx_n_s_int_2) < 0) __PYX_ERR(0, 4193, __pyx_L1_error)
if (PyDict_SetItem(__pyx_t_43, __pyx_n_s_initial_element, __pyx_kp_s_Optional_float) < 0) __PYX_ERR(0, 4193, __pyx_L1_error)
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_435make_moving_max, 0, __pyx_n_s_make_moving_max, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__500)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 4193, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
__Pyx_CyFunction_SetDefaultsTuple(__pyx_t_40, __pyx_tuple__501);
__Pyx_CyFunction_SetAnnotationsDict(__pyx_t_40, __pyx_t_43);
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
if (PyDict_SetItem(__pyx_d, __pyx_n_s_make_moving_max, __pyx_t_40) < 0) __PYX_ERR(0, 4193, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
__pyx_tuple__501 = PyTuple_Pack(2, Py_None, __pyx_float_0_0); if (unlikely(!__pyx_tuple__501)) __PYX_ERR(0, 4193, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__501);
__Pyx_GIVEREF(__pyx_tuple__501);
/* … */
struct __pyx_opt_args_8pysndlib_3clm_make_moving_max {
int __pyx_n;
PyObject *initial_contents;
PyObject *initial_element;
};
+4194: initial_contents=None,
PyObject *__pyx_v_initial_contents = ((PyObject *)Py_None);
PyObject *__pyx_v_initial_element = ((PyObject *)__pyx_float_0_0);
__Pyx_memviewslice __pyx_v_initial_contents_view = { 0, 0, { 0 }, { 0 }, { 0 } };
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = NULL;
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_r = NULL;
if (__pyx_optional_args) {
if (__pyx_optional_args->__pyx_n > 0) {
__pyx_v_initial_contents = __pyx_optional_args->initial_contents;
if (__pyx_optional_args->__pyx_n > 1) {
__pyx_v_initial_element = __pyx_optional_args->initial_element;
}
}
}
__Pyx_INCREF(__pyx_v_initial_contents);
/* … */
values[1] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
values[2] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)__pyx_float_0_0));
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_size)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4193, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_initial_contents);
if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4193, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 2:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_initial_element);
if (value) { values[2] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4193, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "make_moving_max") < 0)) __PYX_ERR(0, 4193, __pyx_L3_error)
}
} else {
switch (__pyx_nargs) {
case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
break;
default: goto __pyx_L5_argtuple_error;
}
}
__pyx_v_size = ((PyObject*)values[0]);
__pyx_v_initial_contents = values[1];
__pyx_v_initial_element = values[2];
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("make_moving_max", 0, 1, 3, __pyx_nargs); __PYX_ERR(0, 4193, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.make_moving_max", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_size), (&PyInt_Type), 0, "size", 1))) __PYX_ERR(0, 4193, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_434make_moving_max(__pyx_self, __pyx_v_size, __pyx_v_initial_contents, __pyx_v_initial_element);
4195: initial_element: Optional[float]=0.0):
4196:
4197: """
4198: return a new moving-max generator.
4199:
4200: :param size: max window length \in samples
4201: :param initial_contents: initial values
4202: :param initial_element: initial element
4203: :return: moving_max gen
4204: :rtype: mus_any
4205: """
4206:
+4207: check_range('size', size, 0.0, None)
__pyx_t_2.__pyx_n = 2; __pyx_t_2.low = __pyx_float_0_0; __pyx_t_2.high = Py_None; __pyx_t_1 = __pyx_f_8pysndlib_3clm_check_range(__pyx_n_s_size, __pyx_v_size, 0, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4207, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4208:
+4209: cdef double [:] initial_contents_view = None
__pyx_t_3 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(Py_None, PyBUF_WRITABLE); if (unlikely(!__pyx_t_3.memview)) __PYX_ERR(0, 4209, __pyx_L1_error) __pyx_v_initial_contents_view = __pyx_t_3; __pyx_t_3.memview = NULL; __pyx_t_3.data = NULL;
4210:
+4211: if initial_contents is not None:
__pyx_t_4 = (__pyx_v_initial_contents != Py_None);
if (__pyx_t_4) {
/* … */
goto __pyx_L3;
}
+4212: if isinstance(initial_contents, list):
__pyx_t_4 = PyList_Check(__pyx_v_initial_contents);
if (__pyx_t_4) {
/* … */
}
+4213: initial_contents = np.array(initial_contents)
__Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4213, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_array); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 4213, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_5 = NULL; __pyx_t_7 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_6))) { __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6); if (likely(__pyx_t_5)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); __Pyx_INCREF(__pyx_t_5); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_6, function); __pyx_t_7 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_v_initial_contents}; __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7); __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4213, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; } __Pyx_DECREF_SET(__pyx_v_initial_contents, __pyx_t_1); __pyx_t_1 = 0;
+4214: check_ndim(initial_contents)
__pyx_t_1 = __pyx_f_8pysndlib_3clm_check_ndim(__pyx_v_initial_contents, 0, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4214, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+4215: initial_contents_view = initial_contents
__pyx_t_3 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_v_initial_contents, PyBUF_WRITABLE); if (unlikely(!__pyx_t_3.memview)) __PYX_ERR(0, 4215, __pyx_L1_error) __PYX_XCLEAR_MEMVIEW(&__pyx_v_initial_contents_view, 1); __pyx_v_initial_contents_view = __pyx_t_3; __pyx_t_3.memview = NULL; __pyx_t_3.data = NULL;
4216:
+4217: elif initial_element:
__pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_initial_element); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 4217, __pyx_L1_error) if (__pyx_t_4) { /* … */ } __pyx_L3:;
+4218: initial_contents = np.zeros(size, dtype=np.double)
__Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4218, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_zeros); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 4218, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4218, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_v_size); __Pyx_GIVEREF(__pyx_v_size); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_size)) __PYX_ERR(0, 4218, __pyx_L1_error); __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4218, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 4218, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_double); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 4218, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_dtype, __pyx_t_9) < 0) __PYX_ERR(0, 4218, __pyx_L1_error) __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_1, __pyx_t_5); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 4218, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF_SET(__pyx_v_initial_contents, __pyx_t_9); __pyx_t_9 = 0;
+4219: check_ndim(initial_contents)
__pyx_t_9 = __pyx_f_8pysndlib_3clm_check_ndim(__pyx_v_initial_contents, 0, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 4219, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+4220: initial_contents.fill(initial_element)
__pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_initial_contents, __pyx_n_s_fill); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4220, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_1 = NULL; __pyx_t_7 = 0; #if CYTHON_UNPACK_METHODS if (likely(PyMethod_Check(__pyx_t_5))) { __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_5); if (likely(__pyx_t_1)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); __Pyx_INCREF(__pyx_t_1); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_5, function); __pyx_t_7 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_v_initial_element}; __pyx_t_9 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7); __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 4220, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+4221: initial_contents_view = initial_contents
__pyx_t_3 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_v_initial_contents, PyBUF_WRITABLE); if (unlikely(!__pyx_t_3.memview)) __PYX_ERR(0, 4221, __pyx_L1_error) __PYX_XCLEAR_MEMVIEW(&__pyx_v_initial_contents_view, 1); __pyx_v_initial_contents_view = __pyx_t_3; __pyx_t_3.memview = NULL; __pyx_t_3.data = NULL;
+4222: if initial_contents_view is not None:
__pyx_t_4 = (((PyObject *) __pyx_v_initial_contents_view.memview) != Py_None);
if (__pyx_t_4) {
/* … */
goto __pyx_L5;
}
+4223: gen = mus_any.from_ptr(cclm.mus_make_moving_max(size, &initial_contents_view[0]))
__pyx_t_7 = __Pyx_PyInt_As_int(__pyx_v_size); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 4223, __pyx_L1_error) __pyx_t_10 = 0; __pyx_t_11 = -1; if (__pyx_t_10 < 0) { __pyx_t_10 += __pyx_v_initial_contents_view.shape[0]; if (unlikely(__pyx_t_10 < 0)) __pyx_t_11 = 0; } else if (unlikely(__pyx_t_10 >= __pyx_v_initial_contents_view.shape[0])) __pyx_t_11 = 0; if (unlikely(__pyx_t_11 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_11); __PYX_ERR(0, 4223, __pyx_L1_error) } __pyx_t_9 = ((PyObject *)__pyx_vtabptr_8pysndlib_3clm_mus_any->from_ptr(mus_make_moving_max(__pyx_t_7, (&(*((double *) ( /* dim=0 */ (__pyx_v_initial_contents_view.data + __pyx_t_10 * __pyx_v_initial_contents_view.strides[0]) ))))), NULL)); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 4223, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_t_9); __pyx_t_9 = 0;
+4224: gen.cache_append(initial_contents)
__pyx_t_9 = ((struct __pyx_vtabstruct_8pysndlib_3clm_mus_any *)__pyx_v_gen->__pyx_vtab)->cache_append(__pyx_v_gen, __pyx_v_initial_contents, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 4224, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
4225: else:
+4226: gen = mus_any.from_ptr(cclm.mus_make_moving_max(size, NULL))
/*else*/ {
__pyx_t_7 = __Pyx_PyInt_As_int(__pyx_v_size); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 4226, __pyx_L1_error)
__pyx_t_9 = ((PyObject *)__pyx_vtabptr_8pysndlib_3clm_mus_any->from_ptr(mus_make_moving_max(__pyx_t_7, NULL), NULL)); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 4226, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_9);
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_t_9);
__pyx_t_9 = 0;
}
__pyx_L5:;
+4227: return gen
__Pyx_XDECREF((PyObject *)__pyx_r); __Pyx_INCREF((PyObject *)__pyx_v_gen); __pyx_r = __pyx_v_gen; goto __pyx_L0;
4228:
+4229: cpdef cython.double moving_max(gen: mus_any, insig: float):
static PyObject *__pyx_pw_8pysndlib_3clm_437moving_max(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static double __pyx_f_8pysndlib_3clm_moving_max(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, double __pyx_v_insig, CYTHON_UNUSED int __pyx_skip_dispatch) {
double __pyx_r;
/* … */
/* function exit code */
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_437moving_max(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_436moving_max, "\n moving window max.\n \n :param gen: moving_max gen\n :param insig: input value\n :rtype: float\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_437moving_max = {"moving_max", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_437moving_max, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_436moving_max};
static PyObject *__pyx_pw_8pysndlib_3clm_437moving_max(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = 0;
double __pyx_v_insig;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("moving_max (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gen,&__pyx_n_s_insig,0};
PyObject* values[2] = {0,0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_gen)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4229, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_insig)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4229, __pyx_L3_error)
else {
__Pyx_RaiseArgtupleInvalid("moving_max", 1, 2, 2, 1); __PYX_ERR(0, 4229, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "moving_max") < 0)) __PYX_ERR(0, 4229, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 2)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
}
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)values[0]);
__pyx_v_insig = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_insig == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 4229, __pyx_L3_error)
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("moving_max", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 4229, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.moving_max", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gen), __pyx_ptype_8pysndlib_3clm_mus_any, 0, "gen", 0))) __PYX_ERR(0, 4229, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_436moving_max(__pyx_self, __pyx_v_gen, __pyx_v_insig);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_436moving_max(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, double __pyx_v_insig) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8pysndlib_3clm_moving_max(__pyx_v_gen, __pyx_v_insig, 0); if (unlikely(__pyx_t_1 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 4229, __pyx_L1_error)
__pyx_t_2 = PyFloat_FromDouble(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4229, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("pysndlib.clm.moving_max", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_40 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 4229, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
if (PyDict_SetItem(__pyx_t_40, __pyx_n_s_gen, __pyx_n_s_mus_any) < 0) __PYX_ERR(0, 4229, __pyx_L1_error)
if (PyDict_SetItem(__pyx_t_40, __pyx_n_s_insig, __pyx_n_s_float) < 0) __PYX_ERR(0, 4229, __pyx_L1_error)
__pyx_t_43 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_437moving_max, 0, __pyx_n_s_moving_max, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__502)); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 4229, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
__Pyx_CyFunction_SetAnnotationsDict(__pyx_t_43, __pyx_t_40);
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
if (PyDict_SetItem(__pyx_d, __pyx_n_s_moving_max, __pyx_t_43) < 0) __PYX_ERR(0, 4229, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
/* … */
__pyx_codeobj__502 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__380, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_moving_max, 4229, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__502)) __PYX_ERR(0, 4229, __pyx_L1_error)
4230: """
4231: moving window max.
4232:
4233: :param gen: moving_max gen
4234: :param insig: input value
4235: :rtype: float
4236: """
+4237: return cclm.mus_moving_max(gen._ptr, insig)
__pyx_r = mus_moving_max(__pyx_v_gen->_ptr, __pyx_v_insig); goto __pyx_L0;
4238:
+4239: cpdef bint is_moving_max(gen: mus_any):
static PyObject *__pyx_pw_8pysndlib_3clm_439is_moving_max(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static int __pyx_f_8pysndlib_3clm_is_moving_max(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, CYTHON_UNUSED int __pyx_skip_dispatch) {
int __pyx_r;
/* … */
/* function exit code */
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_439is_moving_max(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_438is_moving_max, "\n returns True if gen is a moving_max.\n \n :param gen: gen\n :rtype: bool\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_439is_moving_max = {"is_moving_max", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_439is_moving_max, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_438is_moving_max};
static PyObject *__pyx_pw_8pysndlib_3clm_439is_moving_max(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("is_moving_max (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gen,0};
PyObject* values[1] = {0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_gen)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4239, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "is_moving_max") < 0)) __PYX_ERR(0, 4239, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 1)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
}
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)values[0]);
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("is_moving_max", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 4239, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.is_moving_max", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gen), __pyx_ptype_8pysndlib_3clm_mus_any, 0, "gen", 0))) __PYX_ERR(0, 4239, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_438is_moving_max(__pyx_self, __pyx_v_gen);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_438is_moving_max(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8pysndlib_3clm_is_moving_max(__pyx_v_gen, 0); if (unlikely(__pyx_t_1 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 4239, __pyx_L1_error)
__pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4239, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("pysndlib.clm.is_moving_max", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_43 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 4239, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
if (PyDict_SetItem(__pyx_t_43, __pyx_n_s_gen, __pyx_n_s_mus_any) < 0) __PYX_ERR(0, 4239, __pyx_L1_error)
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_439is_moving_max, 0, __pyx_n_s_is_moving_max, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__503)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 4239, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
__Pyx_CyFunction_SetAnnotationsDict(__pyx_t_40, __pyx_t_43);
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
if (PyDict_SetItem(__pyx_d, __pyx_n_s_is_moving_max, __pyx_t_40) < 0) __PYX_ERR(0, 4239, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
/* … */
__pyx_codeobj__503 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__56, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_is_moving_max, 4239, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__503)) __PYX_ERR(0, 4239, __pyx_L1_error)
4240: """
4241: returns True if gen is a moving_max.
4242:
4243: :param gen: gen
4244: :rtype: bool
4245: """
+4246: return cclm.mus_is_moving_max(gen._ptr)
__pyx_r = mus_is_moving_max(__pyx_v_gen->_ptr); goto __pyx_L0;
4247:
4248: # ---------------- moving-norm ---------------- #
+4249: cpdef mus_any make_moving_norm(size: int, initial_contents=None, scaler: Optional[float]=1.):
static PyObject *__pyx_pw_8pysndlib_3clm_441make_moving_norm(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_f_8pysndlib_3clm_make_moving_norm(PyObject *__pyx_v_size, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_8pysndlib_3clm_make_moving_norm *__pyx_optional_args) {
PyObject *__pyx_v_initial_contents = ((PyObject *)Py_None);
PyObject *__pyx_v_scaler = ((PyObject *)__pyx_float_1_);
__Pyx_memviewslice __pyx_v_initial_contents_view = { 0, 0, { 0 }, { 0 }, { 0 } };
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = NULL;
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_r = NULL;
if (__pyx_optional_args) {
if (__pyx_optional_args->__pyx_n > 0) {
__pyx_v_initial_contents = __pyx_optional_args->initial_contents;
if (__pyx_optional_args->__pyx_n > 1) {
__pyx_v_scaler = __pyx_optional_args->scaler;
}
}
}
__Pyx_INCREF(__pyx_v_initial_contents);
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__PYX_XCLEAR_MEMVIEW(&__pyx_t_3, 1);
__Pyx_XDECREF(__pyx_t_5);
__Pyx_XDECREF(__pyx_t_6);
__Pyx_AddTraceback("pysndlib.clm.make_moving_norm", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__PYX_XCLEAR_MEMVIEW(&__pyx_v_initial_contents_view, 1);
__Pyx_XDECREF((PyObject *)__pyx_v_gen);
__Pyx_XDECREF(__pyx_v_initial_contents);
__Pyx_XGIVEREF((PyObject *)__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_441make_moving_norm(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_440make_moving_norm, "\n return a new moving-norm generator.\n \n :param size: averaging length \\in samples\n :param initial_contents: initial values\n :param scaler: normalzing value\n :return: moving_norm gen\n :rtype: mus_any\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_441make_moving_norm = {"make_moving_norm", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_441make_moving_norm, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_440make_moving_norm};
static PyObject *__pyx_pw_8pysndlib_3clm_441make_moving_norm(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
PyObject *__pyx_v_size = 0;
PyObject *__pyx_v_initial_contents = 0;
PyObject *__pyx_v_scaler = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("make_moving_norm (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_size,&__pyx_n_s_initial_contents,&__pyx_n_s_scaler,0};
PyObject* values[3] = {0,0,0};
values[1] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
values[2] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)__pyx_float_1_));
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_size)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4249, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_initial_contents);
if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4249, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 2:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_scaler);
if (value) { values[2] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4249, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "make_moving_norm") < 0)) __PYX_ERR(0, 4249, __pyx_L3_error)
}
} else {
switch (__pyx_nargs) {
case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
break;
default: goto __pyx_L5_argtuple_error;
}
}
__pyx_v_size = ((PyObject*)values[0]);
__pyx_v_initial_contents = values[1];
__pyx_v_scaler = values[2];
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("make_moving_norm", 0, 1, 3, __pyx_nargs); __PYX_ERR(0, 4249, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.make_moving_norm", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_size), (&PyInt_Type), 0, "size", 1))) __PYX_ERR(0, 4249, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_440make_moving_norm(__pyx_self, __pyx_v_size, __pyx_v_initial_contents, __pyx_v_scaler);
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_440make_moving_norm(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_size, PyObject *__pyx_v_initial_contents, PyObject *__pyx_v_scaler) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_2.__pyx_n = 2;
__pyx_t_2.initial_contents = __pyx_v_initial_contents;
__pyx_t_2.scaler = __pyx_v_scaler;
__pyx_t_1 = ((PyObject *)__pyx_f_8pysndlib_3clm_make_moving_norm(__pyx_v_size, 0, &__pyx_t_2)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4249, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("pysndlib.clm.make_moving_norm", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_tuple__504 = PyTuple_Pack(3, __pyx_n_s_size, __pyx_n_s_initial_contents, __pyx_n_s_scaler); if (unlikely(!__pyx_tuple__504)) __PYX_ERR(0, 4249, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__504);
__Pyx_GIVEREF(__pyx_tuple__504);
__pyx_codeobj__505 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__504, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_make_moving_norm, 4249, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__505)) __PYX_ERR(0, 4249, __pyx_L1_error)
/* … */
__pyx_t_40 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 4249, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
if (PyDict_SetItem(__pyx_t_40, __pyx_n_s_size, __pyx_n_s_int_2) < 0) __PYX_ERR(0, 4249, __pyx_L1_error)
if (PyDict_SetItem(__pyx_t_40, __pyx_n_s_scaler, __pyx_kp_s_Optional_float) < 0) __PYX_ERR(0, 4249, __pyx_L1_error)
__pyx_t_43 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_441make_moving_norm, 0, __pyx_n_s_make_moving_norm, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__505)); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 4249, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
__Pyx_CyFunction_SetDefaultsTuple(__pyx_t_43, __pyx_tuple__506);
__Pyx_CyFunction_SetAnnotationsDict(__pyx_t_43, __pyx_t_40);
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
if (PyDict_SetItem(__pyx_d, __pyx_n_s_make_moving_norm, __pyx_t_43) < 0) __PYX_ERR(0, 4249, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
__pyx_tuple__506 = PyTuple_Pack(2, Py_None, __pyx_float_1_); if (unlikely(!__pyx_tuple__506)) __PYX_ERR(0, 4249, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__506);
__Pyx_GIVEREF(__pyx_tuple__506);
/* … */
struct __pyx_opt_args_8pysndlib_3clm_make_moving_norm {
int __pyx_n;
PyObject *initial_contents;
PyObject *scaler;
};
4250: """
4251: return a new moving-norm generator.
4252:
4253: :param size: averaging length \in samples
4254: :param initial_contents: initial values
4255: :param scaler: normalzing value
4256: :return: moving_norm gen
4257: :rtype: mus_any
4258: """
4259:
+4260: check_range('size', size, 0.0, None)
__pyx_t_2.__pyx_n = 2; __pyx_t_2.low = __pyx_float_0_0; __pyx_t_2.high = Py_None; __pyx_t_1 = __pyx_f_8pysndlib_3clm_check_range(__pyx_n_s_size, __pyx_v_size, 0, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4260, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4261:
+4262: cdef double [:] initial_contents_view = None
__pyx_t_3 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(Py_None, PyBUF_WRITABLE); if (unlikely(!__pyx_t_3.memview)) __PYX_ERR(0, 4262, __pyx_L1_error) __pyx_v_initial_contents_view = __pyx_t_3; __pyx_t_3.memview = NULL; __pyx_t_3.data = NULL;
4263:
4264:
+4265: if initial_contents is not None:
__pyx_t_4 = (__pyx_v_initial_contents != Py_None);
if (__pyx_t_4) {
/* … */
}
+4266: if isinstance(initial_contents, list):
__pyx_t_4 = PyList_Check(__pyx_v_initial_contents);
if (__pyx_t_4) {
/* … */
}
+4267: initial_contents = np.array(initial_contents)
__Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4267, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_array); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 4267, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_5 = NULL; __pyx_t_7 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_6))) { __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6); if (likely(__pyx_t_5)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); __Pyx_INCREF(__pyx_t_5); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_6, function); __pyx_t_7 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_v_initial_contents}; __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7); __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4267, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; } __Pyx_DECREF_SET(__pyx_v_initial_contents, __pyx_t_1); __pyx_t_1 = 0;
+4268: check_ndim(initial_contents)
__pyx_t_1 = __pyx_f_8pysndlib_3clm_check_ndim(__pyx_v_initial_contents, 0, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4268, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+4269: initial_contents_view = initial_contents
__pyx_t_3 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_v_initial_contents, PyBUF_WRITABLE); if (unlikely(!__pyx_t_3.memview)) __PYX_ERR(0, 4269, __pyx_L1_error) __PYX_XCLEAR_MEMVIEW(&__pyx_v_initial_contents_view, 1); __pyx_v_initial_contents_view = __pyx_t_3; __pyx_t_3.memview = NULL; __pyx_t_3.data = NULL;
4270:
+4271: if initial_contents_view is not None:
__pyx_t_4 = (((PyObject *) __pyx_v_initial_contents_view.memview) != Py_None);
if (__pyx_t_4) {
/* … */
goto __pyx_L5;
}
+4272: gen = mus_any.from_ptr(cclm.mus_make_moving_norm(size, &initial_contents_view[0], scaler))
__pyx_t_7 = __Pyx_PyInt_As_int(__pyx_v_size); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 4272, __pyx_L1_error) __pyx_t_8 = 0; __pyx_t_9 = -1; if (__pyx_t_8 < 0) { __pyx_t_8 += __pyx_v_initial_contents_view.shape[0]; if (unlikely(__pyx_t_8 < 0)) __pyx_t_9 = 0; } else if (unlikely(__pyx_t_8 >= __pyx_v_initial_contents_view.shape[0])) __pyx_t_9 = 0; if (unlikely(__pyx_t_9 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_9); __PYX_ERR(0, 4272, __pyx_L1_error) } __pyx_t_10 = __pyx_PyFloat_AsDouble(__pyx_v_scaler); if (unlikely((__pyx_t_10 == ((mus_float_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 4272, __pyx_L1_error) __pyx_t_1 = ((PyObject *)__pyx_vtabptr_8pysndlib_3clm_mus_any->from_ptr(mus_make_moving_norm(__pyx_t_7, (&(*((double *) ( /* dim=0 */ (__pyx_v_initial_contents_view.data + __pyx_t_8 * __pyx_v_initial_contents_view.strides[0]) )))), __pyx_t_10), NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4272, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_t_1); __pyx_t_1 = 0;
+4273: gen.cache_append(initial_contents)
__pyx_t_1 = ((struct __pyx_vtabstruct_8pysndlib_3clm_mus_any *)__pyx_v_gen->__pyx_vtab)->cache_append(__pyx_v_gen, __pyx_v_initial_contents, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4273, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4274: else:
+4275: gen = mus_any.from_ptr(cclm.mus_make_moving_norm(size, NULL, scaler))
/*else*/ {
__pyx_t_7 = __Pyx_PyInt_As_int(__pyx_v_size); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 4275, __pyx_L1_error)
__pyx_t_10 = __pyx_PyFloat_AsDouble(__pyx_v_scaler); if (unlikely((__pyx_t_10 == ((mus_float_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 4275, __pyx_L1_error)
__pyx_t_1 = ((PyObject *)__pyx_vtabptr_8pysndlib_3clm_mus_any->from_ptr(mus_make_moving_norm(__pyx_t_7, NULL, __pyx_t_10), NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4275, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_t_1);
__pyx_t_1 = 0;
}
__pyx_L5:;
4276:
+4277: return gen
__Pyx_XDECREF((PyObject *)__pyx_r); __Pyx_INCREF((PyObject *)__pyx_v_gen); __pyx_r = __pyx_v_gen; goto __pyx_L0;
4278:
+4279: cpdef cython.double moving_norm(gen: mus_any, insig: float):
static PyObject *__pyx_pw_8pysndlib_3clm_443moving_norm(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static double __pyx_f_8pysndlib_3clm_moving_norm(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, double __pyx_v_insig, CYTHON_UNUSED int __pyx_skip_dispatch) {
double __pyx_r;
/* … */
/* function exit code */
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_443moving_norm(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_442moving_norm, "\n moving window norm.\n \n :param gen: moving_norm gen\n :param insig: input value\n :rtype: float\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_443moving_norm = {"moving_norm", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_443moving_norm, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_442moving_norm};
static PyObject *__pyx_pw_8pysndlib_3clm_443moving_norm(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = 0;
double __pyx_v_insig;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("moving_norm (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gen,&__pyx_n_s_insig,0};
PyObject* values[2] = {0,0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_gen)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4279, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_insig)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4279, __pyx_L3_error)
else {
__Pyx_RaiseArgtupleInvalid("moving_norm", 1, 2, 2, 1); __PYX_ERR(0, 4279, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "moving_norm") < 0)) __PYX_ERR(0, 4279, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 2)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
}
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)values[0]);
__pyx_v_insig = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_insig == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 4279, __pyx_L3_error)
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("moving_norm", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 4279, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.moving_norm", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gen), __pyx_ptype_8pysndlib_3clm_mus_any, 0, "gen", 0))) __PYX_ERR(0, 4279, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_442moving_norm(__pyx_self, __pyx_v_gen, __pyx_v_insig);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_442moving_norm(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, double __pyx_v_insig) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8pysndlib_3clm_moving_norm(__pyx_v_gen, __pyx_v_insig, 0); if (unlikely(__pyx_t_1 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 4279, __pyx_L1_error)
__pyx_t_2 = PyFloat_FromDouble(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4279, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("pysndlib.clm.moving_norm", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_43 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 4279, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
if (PyDict_SetItem(__pyx_t_43, __pyx_n_s_gen, __pyx_n_s_mus_any) < 0) __PYX_ERR(0, 4279, __pyx_L1_error)
if (PyDict_SetItem(__pyx_t_43, __pyx_n_s_insig, __pyx_n_s_float) < 0) __PYX_ERR(0, 4279, __pyx_L1_error)
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_443moving_norm, 0, __pyx_n_s_moving_norm, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__507)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 4279, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
__Pyx_CyFunction_SetAnnotationsDict(__pyx_t_40, __pyx_t_43);
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
if (PyDict_SetItem(__pyx_d, __pyx_n_s_moving_norm, __pyx_t_40) < 0) __PYX_ERR(0, 4279, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
/* … */
__pyx_codeobj__507 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__380, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_moving_norm, 4279, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__507)) __PYX_ERR(0, 4279, __pyx_L1_error)
4280: """
4281: moving window norm.
4282:
4283: :param gen: moving_norm gen
4284: :param insig: input value
4285: :rtype: float
4286: """
+4287: return cclm.mus_moving_norm(gen._ptr, insig)
__pyx_r = mus_moving_norm(__pyx_v_gen->_ptr, __pyx_v_insig); goto __pyx_L0;
4288:
+4289: cpdef is_moving_norm(gen: mus_any):
static PyObject *__pyx_pw_8pysndlib_3clm_445is_moving_norm(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyObject *__pyx_f_8pysndlib_3clm_is_moving_norm(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, CYTHON_UNUSED int __pyx_skip_dispatch) {
PyObject *__pyx_r = NULL;
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("pysndlib.clm.is_moving_norm", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_445is_moving_norm(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_444is_moving_norm, "\n returns True if gen is a moving_norm.\n \n :param gen: gen\n :rtype: bool\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_445is_moving_norm = {"is_moving_norm", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_445is_moving_norm, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_444is_moving_norm};
static PyObject *__pyx_pw_8pysndlib_3clm_445is_moving_norm(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("is_moving_norm (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gen,0};
PyObject* values[1] = {0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_gen)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4289, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "is_moving_norm") < 0)) __PYX_ERR(0, 4289, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 1)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
}
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)values[0]);
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("is_moving_norm", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 4289, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.is_moving_norm", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gen), __pyx_ptype_8pysndlib_3clm_mus_any, 0, "gen", 0))) __PYX_ERR(0, 4289, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_444is_moving_norm(__pyx_self, __pyx_v_gen);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_444is_moving_norm(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8pysndlib_3clm_is_moving_norm(__pyx_v_gen, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4289, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("pysndlib.clm.is_moving_norm", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_40 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 4289, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
if (PyDict_SetItem(__pyx_t_40, __pyx_n_s_gen, __pyx_n_s_mus_any) < 0) __PYX_ERR(0, 4289, __pyx_L1_error)
__pyx_t_43 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_445is_moving_norm, 0, __pyx_n_s_is_moving_norm, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__508)); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 4289, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
__Pyx_CyFunction_SetAnnotationsDict(__pyx_t_43, __pyx_t_40);
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
if (PyDict_SetItem(__pyx_d, __pyx_n_s_is_moving_norm, __pyx_t_43) < 0) __PYX_ERR(0, 4289, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
/* … */
__pyx_codeobj__508 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__56, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_is_moving_norm, 4289, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__508)) __PYX_ERR(0, 4289, __pyx_L1_error)
4290: """
4291: returns True if gen is a moving_norm.
4292:
4293: :param gen: gen
4294: :rtype: bool
4295: """
+4296: return cclm.mus_is_moving_norm(gen._ptr)
__Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyBool_FromLong(mus_is_moving_norm(__pyx_v_gen->_ptr)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4296, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
4297:
4298:
4299: # ---------------- asymmetric-fm ---------------- #
+4300: cpdef mus_any make_asymmetric_fm(frequency: float, initial_phase: Optional[float]=0.0, r: Optional[float]=1.0, ratio: Optional[float]=1.):
static PyObject *__pyx_pw_8pysndlib_3clm_447make_asymmetric_fm(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_f_8pysndlib_3clm_make_asymmetric_fm(double __pyx_v_frequency, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_8pysndlib_3clm_make_asymmetric_fm *__pyx_optional_args) {
PyObject *__pyx_v_initial_phase = ((PyObject *)__pyx_float_0_0);
PyObject *__pyx_v_r = ((PyObject *)__pyx_float_1_0);
PyObject *__pyx_v_ratio = ((PyObject *)__pyx_float_1_);
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_r = NULL;
if (__pyx_optional_args) {
if (__pyx_optional_args->__pyx_n > 0) {
__pyx_v_initial_phase = __pyx_optional_args->initial_phase;
if (__pyx_optional_args->__pyx_n > 1) {
__pyx_v_r = __pyx_optional_args->r;
if (__pyx_optional_args->__pyx_n > 2) {
__pyx_v_ratio = __pyx_optional_args->ratio;
}
}
}
}
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("pysndlib.clm.make_asymmetric_fm", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XGIVEREF((PyObject *)__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_447make_asymmetric_fm(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_446make_asymmetric_fm, "\n return a new asymmetric_fm generator.\n \n :param frequency: frequency of gen\n :param initial_phase: starting phase of gen, \\in radians\n :param r: amplitude ratio between successive sidebands\n :param ratio: ratio between carrier and sideband spacing\n :return: asymmetric_fm gen\n :rtype: mus_any\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_447make_asymmetric_fm = {"make_asymmetric_fm", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_447make_asymmetric_fm, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_446make_asymmetric_fm};
static PyObject *__pyx_pw_8pysndlib_3clm_447make_asymmetric_fm(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
double __pyx_v_frequency;
PyObject *__pyx_v_initial_phase = 0;
PyObject *__pyx_v_r = 0;
PyObject *__pyx_v_ratio = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("make_asymmetric_fm (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_frequency,&__pyx_n_s_initial_phase,&__pyx_n_s_r,&__pyx_n_s_ratio,0};
PyObject* values[4] = {0,0,0,0};
values[1] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)__pyx_float_0_0));
values[2] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)__pyx_float_1_0));
values[3] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)__pyx_float_1_));
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
CYTHON_FALLTHROUGH;
case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_frequency)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4300, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_initial_phase);
if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4300, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 2:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_r);
if (value) { values[2] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4300, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 3:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_ratio);
if (value) { values[3] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4300, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "make_asymmetric_fm") < 0)) __PYX_ERR(0, 4300, __pyx_L3_error)
}
} else {
switch (__pyx_nargs) {
case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
CYTHON_FALLTHROUGH;
case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
break;
default: goto __pyx_L5_argtuple_error;
}
}
__pyx_v_frequency = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_frequency == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 4300, __pyx_L3_error)
__pyx_v_initial_phase = values[1];
__pyx_v_r = values[2];
__pyx_v_ratio = values[3];
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("make_asymmetric_fm", 0, 1, 4, __pyx_nargs); __PYX_ERR(0, 4300, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.make_asymmetric_fm", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_8pysndlib_3clm_446make_asymmetric_fm(__pyx_self, __pyx_v_frequency, __pyx_v_initial_phase, __pyx_v_r, __pyx_v_ratio);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_446make_asymmetric_fm(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_frequency, PyObject *__pyx_v_initial_phase, PyObject *__pyx_v_r, PyObject *__pyx_v_ratio) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_2.__pyx_n = 3;
__pyx_t_2.initial_phase = __pyx_v_initial_phase;
__pyx_t_2.r = __pyx_v_r;
__pyx_t_2.ratio = __pyx_v_ratio;
__pyx_t_1 = ((PyObject *)__pyx_f_8pysndlib_3clm_make_asymmetric_fm(__pyx_v_frequency, 0, &__pyx_t_2)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4300, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("pysndlib.clm.make_asymmetric_fm", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_tuple__509 = PyTuple_Pack(4, __pyx_n_s_frequency, __pyx_n_s_initial_phase, __pyx_n_s_r, __pyx_n_s_ratio); if (unlikely(!__pyx_tuple__509)) __PYX_ERR(0, 4300, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__509);
__Pyx_GIVEREF(__pyx_tuple__509);
__pyx_codeobj__510 = (PyObject*)__Pyx_PyCode_New(4, 0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__509, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_make_asymmetric_fm, 4300, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__510)) __PYX_ERR(0, 4300, __pyx_L1_error)
/* … */
__pyx_t_43 = __Pyx_PyDict_NewPresized(4); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 4300, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
if (PyDict_SetItem(__pyx_t_43, __pyx_n_s_frequency, __pyx_n_s_float) < 0) __PYX_ERR(0, 4300, __pyx_L1_error)
if (PyDict_SetItem(__pyx_t_43, __pyx_n_s_initial_phase, __pyx_kp_s_Optional_float) < 0) __PYX_ERR(0, 4300, __pyx_L1_error)
if (PyDict_SetItem(__pyx_t_43, __pyx_n_s_r, __pyx_kp_s_Optional_float) < 0) __PYX_ERR(0, 4300, __pyx_L1_error)
if (PyDict_SetItem(__pyx_t_43, __pyx_n_s_ratio, __pyx_kp_s_Optional_float) < 0) __PYX_ERR(0, 4300, __pyx_L1_error)
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_447make_asymmetric_fm, 0, __pyx_n_s_make_asymmetric_fm, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__510)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 4300, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
__Pyx_CyFunction_SetDefaultsTuple(__pyx_t_40, __pyx_tuple__511);
__Pyx_CyFunction_SetAnnotationsDict(__pyx_t_40, __pyx_t_43);
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
if (PyDict_SetItem(__pyx_d, __pyx_n_s_make_asymmetric_fm, __pyx_t_40) < 0) __PYX_ERR(0, 4300, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
__pyx_tuple__511 = PyTuple_Pack(3, __pyx_float_0_0, __pyx_float_1_0, __pyx_float_1_); if (unlikely(!__pyx_tuple__511)) __PYX_ERR(0, 4300, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__511);
__Pyx_GIVEREF(__pyx_tuple__511);
/* … */
struct __pyx_opt_args_8pysndlib_3clm_make_asymmetric_fm {
int __pyx_n;
PyObject *initial_phase;
PyObject *r;
PyObject *ratio;
};
4301: """
4302: return a new asymmetric_fm generator.
4303:
4304: :param frequency: frequency of gen
4305: :param initial_phase: starting phase of gen, \in radians
4306: :param r: amplitude ratio between successive sidebands
4307: :param ratio: ratio between carrier and sideband spacing
4308: :return: asymmetric_fm gen
4309: :rtype: mus_any
4310: """
4311:
+4312: check_range('frequency', frequency, 0.0, None)
__pyx_t_1 = PyFloat_FromDouble(__pyx_v_frequency); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4312, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_3.__pyx_n = 2; __pyx_t_3.low = __pyx_float_0_0; __pyx_t_3.high = Py_None; __pyx_t_2 = __pyx_f_8pysndlib_3clm_check_range(__pyx_n_s_frequency, __pyx_t_1, 0, &__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4312, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4313:
+4314: return mus_any.from_ptr(cclm.mus_make_asymmetric_fm(frequency, initial_phase, r, ratio))
__Pyx_XDECREF((PyObject *)__pyx_r); __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_v_initial_phase); if (unlikely((__pyx_t_4 == ((mus_float_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 4314, __pyx_L1_error) __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_v_r); if (unlikely((__pyx_t_5 == ((mus_float_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 4314, __pyx_L1_error) __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_v_ratio); if (unlikely((__pyx_t_6 == ((mus_float_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 4314, __pyx_L1_error) __pyx_t_2 = ((PyObject *)__pyx_vtabptr_8pysndlib_3clm_mus_any->from_ptr(mus_make_asymmetric_fm(__pyx_v_frequency, __pyx_t_4, __pyx_t_5, __pyx_t_6), NULL)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4314, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_r = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_t_2); __pyx_t_2 = 0; goto __pyx_L0;
4315:
+4316: cpdef cython.double asymmetric_fm(gen: mus_any, index: float, fm: Optional[float]=None):
static PyObject *__pyx_pw_8pysndlib_3clm_449asymmetric_fm(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static double __pyx_f_8pysndlib_3clm_asymmetric_fm(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, double __pyx_v_index, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_8pysndlib_3clm_asymmetric_fm *__pyx_optional_args) {
PyObject *__pyx_v_fm = ((PyObject *)Py_None);
double __pyx_r;
if (__pyx_optional_args) {
if (__pyx_optional_args->__pyx_n > 0) {
__pyx_v_fm = __pyx_optional_args->fm;
}
}
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_AddTraceback("pysndlib.clm.asymmetric_fm", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = -1;
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_449asymmetric_fm(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_448asymmetric_fm, "\n next sample from asymmetric fm generator. \n \n :param gen: asymmetric_fm gen\n :param index: fm index\n :param fm: fm input\n :rtype: float\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_449asymmetric_fm = {"asymmetric_fm", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_449asymmetric_fm, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_448asymmetric_fm};
static PyObject *__pyx_pw_8pysndlib_3clm_449asymmetric_fm(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = 0;
double __pyx_v_index;
PyObject *__pyx_v_fm = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("asymmetric_fm (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gen,&__pyx_n_s_index,&__pyx_n_s_fm,0};
PyObject* values[3] = {0,0,0};
values[2] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_gen)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4316, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_index)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4316, __pyx_L3_error)
else {
__Pyx_RaiseArgtupleInvalid("asymmetric_fm", 0, 2, 3, 1); __PYX_ERR(0, 4316, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 2:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_fm);
if (value) { values[2] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4316, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "asymmetric_fm") < 0)) __PYX_ERR(0, 4316, __pyx_L3_error)
}
} else {
switch (__pyx_nargs) {
case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
break;
default: goto __pyx_L5_argtuple_error;
}
}
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)values[0]);
__pyx_v_index = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_index == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 4316, __pyx_L3_error)
__pyx_v_fm = values[2];
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("asymmetric_fm", 0, 2, 3, __pyx_nargs); __PYX_ERR(0, 4316, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.asymmetric_fm", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gen), __pyx_ptype_8pysndlib_3clm_mus_any, 0, "gen", 0))) __PYX_ERR(0, 4316, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_448asymmetric_fm(__pyx_self, __pyx_v_gen, __pyx_v_index, __pyx_v_fm);
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_448asymmetric_fm(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, double __pyx_v_index, PyObject *__pyx_v_fm) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_2.__pyx_n = 1;
__pyx_t_2.fm = __pyx_v_fm;
__pyx_t_1 = __pyx_f_8pysndlib_3clm_asymmetric_fm(__pyx_v_gen, __pyx_v_index, 0, &__pyx_t_2); if (unlikely(__pyx_t_1 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 4316, __pyx_L1_error)
__pyx_t_3 = PyFloat_FromDouble(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4316, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__pyx_r = __pyx_t_3;
__pyx_t_3 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_3);
__Pyx_AddTraceback("pysndlib.clm.asymmetric_fm", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_40 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 4316, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
if (PyDict_SetItem(__pyx_t_40, __pyx_n_s_gen, __pyx_n_s_mus_any) < 0) __PYX_ERR(0, 4316, __pyx_L1_error)
if (PyDict_SetItem(__pyx_t_40, __pyx_n_s_index, __pyx_n_s_float) < 0) __PYX_ERR(0, 4316, __pyx_L1_error)
if (PyDict_SetItem(__pyx_t_40, __pyx_n_s_fm, __pyx_kp_s_Optional_float) < 0) __PYX_ERR(0, 4316, __pyx_L1_error)
__pyx_t_43 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_449asymmetric_fm, 0, __pyx_n_s_asymmetric_fm, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__512)); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 4316, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
__Pyx_CyFunction_SetDefaultsTuple(__pyx_t_43, __pyx_tuple__90);
__Pyx_CyFunction_SetAnnotationsDict(__pyx_t_43, __pyx_t_40);
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
if (PyDict_SetItem(__pyx_d, __pyx_n_s_asymmetric_fm, __pyx_t_43) < 0) __PYX_ERR(0, 4316, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
/* … */
__pyx_codeobj__512 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__312, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_asymmetric_fm, 4316, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__512)) __PYX_ERR(0, 4316, __pyx_L1_error)
/* … */
struct __pyx_opt_args_8pysndlib_3clm_asymmetric_fm {
int __pyx_n;
PyObject *fm;
};
4317: """
4318: next sample from asymmetric fm generator.
4319:
4320: :param gen: asymmetric_fm gen
4321: :param index: fm index
4322: :param fm: fm input
4323: :rtype: float
4324: """
+4325: if fm:
__pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_fm); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 4325, __pyx_L1_error) if (__pyx_t_1) { /* … */ }
+4326: return cclm.mus_asymmetric_fm(gen._ptr, index, fm)
__pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_v_fm); if (unlikely((__pyx_t_2 == ((mus_float_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 4326, __pyx_L1_error) __pyx_r = mus_asymmetric_fm(__pyx_v_gen->_ptr, __pyx_v_index, __pyx_t_2); goto __pyx_L0;
4327: else:
+4328: return cclm.mus_asymmetric_fm_unmodulated(gen._ptr, index)
/*else*/ {
__pyx_r = mus_asymmetric_fm_unmodulated(__pyx_v_gen->_ptr, __pyx_v_index);
goto __pyx_L0;
}
4329:
+4330: cpdef bint is_asymmetric_fm(gen: mus_any):
static PyObject *__pyx_pw_8pysndlib_3clm_451is_asymmetric_fm(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static int __pyx_f_8pysndlib_3clm_is_asymmetric_fm(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, CYTHON_UNUSED int __pyx_skip_dispatch) {
int __pyx_r;
/* … */
/* function exit code */
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_451is_asymmetric_fm(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_450is_asymmetric_fm, "\n returns True if gen is a asymmetric_fm.\n \n :param gen: gen\n :rtype: bool\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_451is_asymmetric_fm = {"is_asymmetric_fm", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_451is_asymmetric_fm, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_450is_asymmetric_fm};
static PyObject *__pyx_pw_8pysndlib_3clm_451is_asymmetric_fm(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("is_asymmetric_fm (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gen,0};
PyObject* values[1] = {0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_gen)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4330, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "is_asymmetric_fm") < 0)) __PYX_ERR(0, 4330, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 1)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
}
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)values[0]);
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("is_asymmetric_fm", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 4330, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.is_asymmetric_fm", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gen), __pyx_ptype_8pysndlib_3clm_mus_any, 0, "gen", 0))) __PYX_ERR(0, 4330, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_450is_asymmetric_fm(__pyx_self, __pyx_v_gen);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_450is_asymmetric_fm(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8pysndlib_3clm_is_asymmetric_fm(__pyx_v_gen, 0); if (unlikely(__pyx_t_1 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 4330, __pyx_L1_error)
__pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4330, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("pysndlib.clm.is_asymmetric_fm", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_43 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 4330, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
if (PyDict_SetItem(__pyx_t_43, __pyx_n_s_gen, __pyx_n_s_mus_any) < 0) __PYX_ERR(0, 4330, __pyx_L1_error)
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_451is_asymmetric_fm, 0, __pyx_n_s_is_asymmetric_fm, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__513)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 4330, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
__Pyx_CyFunction_SetAnnotationsDict(__pyx_t_40, __pyx_t_43);
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
if (PyDict_SetItem(__pyx_d, __pyx_n_s_is_asymmetric_fm, __pyx_t_40) < 0) __PYX_ERR(0, 4330, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
/* … */
__pyx_codeobj__513 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__56, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_is_asymmetric_fm, 4330, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__513)) __PYX_ERR(0, 4330, __pyx_L1_error)
4331: """
4332: returns True if gen is a asymmetric_fm.
4333:
4334: :param gen: gen
4335: :rtype: bool
4336: """
+4337: return cclm.mus_is_asymmetric_fm(gen._ptr)
__pyx_r = mus_is_asymmetric_fm(__pyx_v_gen->_ptr); goto __pyx_L0;
4338:
4339: # ---------------- file-to-sample ---------------- #
+4340: cpdef mus_any make_file2sample(filename, buffer_size: Optional[int]=None):
static PyObject *__pyx_pw_8pysndlib_3clm_453make_file2sample(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_f_8pysndlib_3clm_make_file2sample(PyObject *__pyx_v_filename, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_8pysndlib_3clm_make_file2sample *__pyx_optional_args) {
PyObject *__pyx_v_buffer_size = ((PyObject *)Py_None);
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_r = NULL;
if (__pyx_optional_args) {
if (__pyx_optional_args->__pyx_n > 0) {
__pyx_v_buffer_size = __pyx_optional_args->buffer_size;
}
}
__Pyx_INCREF(__pyx_v_buffer_size);
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_AddTraceback("pysndlib.clm.make_file2sample", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XDECREF(__pyx_v_buffer_size);
__Pyx_XGIVEREF((PyObject *)__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_453make_file2sample(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_452make_file2sample, "\n return an input generator reading 'filename' (a sound file).\n \n :param filename: name of file to read\n :param buffer_size: io buffer size\n :return: file2sample gen\n :rtype: mus_any\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_453make_file2sample = {"make_file2sample", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_453make_file2sample, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_452make_file2sample};
static PyObject *__pyx_pw_8pysndlib_3clm_453make_file2sample(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
PyObject *__pyx_v_filename = 0;
PyObject *__pyx_v_buffer_size = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("make_file2sample (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_filename,&__pyx_n_s_buffer_size,0};
PyObject* values[2] = {0,0};
values[1] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_filename)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4340, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_buffer_size);
if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4340, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "make_file2sample") < 0)) __PYX_ERR(0, 4340, __pyx_L3_error)
}
} else {
switch (__pyx_nargs) {
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
break;
default: goto __pyx_L5_argtuple_error;
}
}
__pyx_v_filename = values[0];
__pyx_v_buffer_size = values[1];
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("make_file2sample", 0, 1, 2, __pyx_nargs); __PYX_ERR(0, 4340, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.make_file2sample", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_8pysndlib_3clm_452make_file2sample(__pyx_self, __pyx_v_filename, __pyx_v_buffer_size);
/* function exit code */
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_452make_file2sample(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_filename, PyObject *__pyx_v_buffer_size) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_2.__pyx_n = 1;
__pyx_t_2.buffer_size = __pyx_v_buffer_size;
__pyx_t_1 = ((PyObject *)__pyx_f_8pysndlib_3clm_make_file2sample(__pyx_v_filename, 0, &__pyx_t_2)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4340, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("pysndlib.clm.make_file2sample", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_tuple__514 = PyTuple_Pack(2, __pyx_n_s_filename, __pyx_n_s_buffer_size); if (unlikely(!__pyx_tuple__514)) __PYX_ERR(0, 4340, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__514);
__Pyx_GIVEREF(__pyx_tuple__514);
/* … */
__pyx_t_40 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 4340, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
if (PyDict_SetItem(__pyx_t_40, __pyx_n_s_buffer_size, __pyx_kp_s_Optional_int) < 0) __PYX_ERR(0, 4340, __pyx_L1_error)
__pyx_t_43 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_453make_file2sample, 0, __pyx_n_s_make_file2sample, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__515)); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 4340, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
__Pyx_CyFunction_SetDefaultsTuple(__pyx_t_43, __pyx_tuple__90);
__Pyx_CyFunction_SetAnnotationsDict(__pyx_t_43, __pyx_t_40);
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
if (PyDict_SetItem(__pyx_d, __pyx_n_s_make_file2sample, __pyx_t_43) < 0) __PYX_ERR(0, 4340, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
__pyx_codeobj__515 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__514, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_make_file2sample, 4340, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__515)) __PYX_ERR(0, 4340, __pyx_L1_error)
/* … */
struct __pyx_opt_args_8pysndlib_3clm_make_file2sample {
int __pyx_n;
PyObject *buffer_size;
};
4341: """
4342: return an input generator reading 'filename' (a sound file).
4343:
4344: :param filename: name of file to read
4345: :param buffer_size: io buffer size
4346: :return: file2sample gen
4347: :rtype: mus_any
4348: """
+4349: if not os.path.isfile(filename):
__Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_os); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4349, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_path); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4349, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_isfile); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4349, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = NULL; __pyx_t_4 = 0; #if CYTHON_UNPACK_METHODS if (likely(PyMethod_Check(__pyx_t_2))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); __pyx_t_4 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v_filename}; __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4349, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 4349, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_6 = (!__pyx_t_5); if (unlikely(__pyx_t_6)) { /* … */ }
+4350: raise FileNotFoundError(f'file2sample: {filename} does not exist.')
__Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_FileNotFoundError); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4350, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4350, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_7 = 0; __pyx_t_8 = 127; __Pyx_INCREF(__pyx_kp_u_file2sample); __pyx_t_7 += 13; __Pyx_GIVEREF(__pyx_kp_u_file2sample); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_kp_u_file2sample); __pyx_t_3 = __Pyx_PyObject_FormatSimple(__pyx_v_filename, __pyx_empty_unicode); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4350, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_8 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3) > __pyx_t_8) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3) : __pyx_t_8; __pyx_t_7 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_3); __pyx_t_3 = 0; __Pyx_INCREF(__pyx_kp_u_does_not_exist); __pyx_t_7 += 16; __Pyx_GIVEREF(__pyx_kp_u_does_not_exist); PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_kp_u_does_not_exist); __pyx_t_3 = __Pyx_PyUnicode_Join(__pyx_t_2, 3, __pyx_t_7, __pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4350, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4350, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __PYX_ERR(0, 4350, __pyx_L1_error)
4351:
+4352: buffer_size = buffer_size or CLM.buffer_size
__pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_buffer_size); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 4352, __pyx_L1_error) if (!__pyx_t_6) { } else { __Pyx_INCREF(__pyx_v_buffer_size); __pyx_t_2 = __pyx_v_buffer_size; goto __pyx_L4_bool_binop_done; } __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_CLM); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4352, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_buffer_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4352, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = __pyx_t_1; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_L4_bool_binop_done:; __Pyx_DECREF_SET(__pyx_v_buffer_size, __pyx_t_2); __pyx_t_2 = 0;
+4353: return mus_any.from_ptr(cclm.mus_make_file_to_sample_with_buffer_size(filename, buffer_size))
__Pyx_XDECREF((PyObject *)__pyx_r); __pyx_t_9 = __Pyx_PyObject_AsString(__pyx_v_filename); if (unlikely((!__pyx_t_9) && PyErr_Occurred())) __PYX_ERR(0, 4353, __pyx_L1_error) __pyx_t_10 = __Pyx_PyInt_As_int64_t(__pyx_v_buffer_size); if (unlikely((__pyx_t_10 == ((mus_long_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 4353, __pyx_L1_error) __pyx_t_2 = ((PyObject *)__pyx_vtabptr_8pysndlib_3clm_mus_any->from_ptr(mus_make_file_to_sample_with_buffer_size(__pyx_t_9, __pyx_t_10), NULL)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4353, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_r = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_t_2); __pyx_t_2 = 0; goto __pyx_L0;
4354:
+4355: cpdef cython.double file2sample(gen: mus_any, loc: int, chan: Optional[int]=0):
static PyObject *__pyx_pw_8pysndlib_3clm_455file2sample(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static double __pyx_f_8pysndlib_3clm_file2sample(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, PyObject *__pyx_v_loc, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_8pysndlib_3clm_file2sample *__pyx_optional_args) {
PyObject *__pyx_v_chan = ((PyObject *)__pyx_int_0);
double __pyx_r;
if (__pyx_optional_args) {
if (__pyx_optional_args->__pyx_n > 0) {
__pyx_v_chan = __pyx_optional_args->chan;
}
}
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_AddTraceback("pysndlib.clm.file2sample", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = -1;
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_455file2sample(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_454file2sample, "\n sample value \\in sound file read by 'obj' \\in channel chan at sample.\n \n :param gen: file2sample gen\n :param loc: location \\in file to read\n :param chan: channel to read\n :rtype: float\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_455file2sample = {"file2sample", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_455file2sample, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_454file2sample};
static PyObject *__pyx_pw_8pysndlib_3clm_455file2sample(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = 0;
PyObject *__pyx_v_loc = 0;
PyObject *__pyx_v_chan = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("file2sample (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gen,&__pyx_n_s_loc,&__pyx_n_s_chan,0};
PyObject* values[3] = {0,0,0};
values[2] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)__pyx_int_0));
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_gen)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4355, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_loc)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4355, __pyx_L3_error)
else {
__Pyx_RaiseArgtupleInvalid("file2sample", 0, 2, 3, 1); __PYX_ERR(0, 4355, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 2:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_chan);
if (value) { values[2] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4355, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "file2sample") < 0)) __PYX_ERR(0, 4355, __pyx_L3_error)
}
} else {
switch (__pyx_nargs) {
case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
break;
default: goto __pyx_L5_argtuple_error;
}
}
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)values[0]);
__pyx_v_loc = ((PyObject*)values[1]);
__pyx_v_chan = values[2];
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("file2sample", 0, 2, 3, __pyx_nargs); __PYX_ERR(0, 4355, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.file2sample", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gen), __pyx_ptype_8pysndlib_3clm_mus_any, 0, "gen", 0))) __PYX_ERR(0, 4355, __pyx_L1_error)
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_loc), (&PyInt_Type), 0, "loc", 1))) __PYX_ERR(0, 4355, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_454file2sample(__pyx_self, __pyx_v_gen, __pyx_v_loc, __pyx_v_chan);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_454file2sample(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, PyObject *__pyx_v_loc, PyObject *__pyx_v_chan) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_2.__pyx_n = 1;
__pyx_t_2.chan = __pyx_v_chan;
__pyx_t_1 = __pyx_f_8pysndlib_3clm_file2sample(__pyx_v_gen, __pyx_v_loc, 0, &__pyx_t_2); if (unlikely(__pyx_t_1 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 4355, __pyx_L1_error)
__pyx_t_3 = PyFloat_FromDouble(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4355, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__pyx_r = __pyx_t_3;
__pyx_t_3 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_3);
__Pyx_AddTraceback("pysndlib.clm.file2sample", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_tuple__516 = PyTuple_Pack(3, __pyx_n_s_gen, __pyx_n_s_loc, __pyx_n_s_chan); if (unlikely(!__pyx_tuple__516)) __PYX_ERR(0, 4355, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__516);
__Pyx_GIVEREF(__pyx_tuple__516);
/* … */
__pyx_t_43 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 4355, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
if (PyDict_SetItem(__pyx_t_43, __pyx_n_s_gen, __pyx_n_s_mus_any) < 0) __PYX_ERR(0, 4355, __pyx_L1_error)
if (PyDict_SetItem(__pyx_t_43, __pyx_n_s_loc, __pyx_n_s_int_2) < 0) __PYX_ERR(0, 4355, __pyx_L1_error)
if (PyDict_SetItem(__pyx_t_43, __pyx_n_s_chan, __pyx_kp_s_Optional_int) < 0) __PYX_ERR(0, 4355, __pyx_L1_error)
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_455file2sample, 0, __pyx_n_s_file2sample_2, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__517)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 4355, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
__Pyx_CyFunction_SetDefaultsTuple(__pyx_t_40, __pyx_tuple__129);
__Pyx_CyFunction_SetAnnotationsDict(__pyx_t_40, __pyx_t_43);
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
if (PyDict_SetItem(__pyx_d, __pyx_n_s_file2sample_2, __pyx_t_40) < 0) __PYX_ERR(0, 4355, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
__pyx_codeobj__517 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__516, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_file2sample_2, 4355, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__517)) __PYX_ERR(0, 4355, __pyx_L1_error)
/* … */
struct __pyx_opt_args_8pysndlib_3clm_file2sample {
int __pyx_n;
PyObject *chan;
};
4356: """
4357: sample value \in sound file read by 'obj' \in channel chan at sample.
4358:
4359: :param gen: file2sample gen
4360: :param loc: location \in file to read
4361: :param chan: channel to read
4362: :rtype: float
4363: """
+4364: return cclm.mus_file_to_sample(gen._ptr, loc, chan)
__pyx_t_1 = __Pyx_PyInt_As_int64_t(__pyx_v_loc); if (unlikely((__pyx_t_1 == ((mus_long_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 4364, __pyx_L1_error) __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_v_chan); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 4364, __pyx_L1_error) __pyx_r = mus_file_to_sample(__pyx_v_gen->_ptr, __pyx_t_1, __pyx_t_2); goto __pyx_L0;
4365:
+4366: cpdef bint is_file2sample(gen: mus_any):
static PyObject *__pyx_pw_8pysndlib_3clm_457is_file2sample(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static int __pyx_f_8pysndlib_3clm_is_file2sample(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, CYTHON_UNUSED int __pyx_skip_dispatch) {
int __pyx_r;
/* … */
/* function exit code */
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_457is_file2sample(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_456is_file2sample, "\n returns True if gen is a file2sample.\n \n :param gen: gen\n :rtype: bool\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_457is_file2sample = {"is_file2sample", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_457is_file2sample, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_456is_file2sample};
static PyObject *__pyx_pw_8pysndlib_3clm_457is_file2sample(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("is_file2sample (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gen,0};
PyObject* values[1] = {0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_gen)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4366, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "is_file2sample") < 0)) __PYX_ERR(0, 4366, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 1)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
}
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)values[0]);
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("is_file2sample", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 4366, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.is_file2sample", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gen), __pyx_ptype_8pysndlib_3clm_mus_any, 0, "gen", 0))) __PYX_ERR(0, 4366, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_456is_file2sample(__pyx_self, __pyx_v_gen);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_456is_file2sample(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8pysndlib_3clm_is_file2sample(__pyx_v_gen, 0); if (unlikely(__pyx_t_1 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 4366, __pyx_L1_error)
__pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4366, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("pysndlib.clm.is_file2sample", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_40 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 4366, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
if (PyDict_SetItem(__pyx_t_40, __pyx_n_s_gen, __pyx_n_s_mus_any) < 0) __PYX_ERR(0, 4366, __pyx_L1_error)
__pyx_t_43 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_457is_file2sample, 0, __pyx_n_s_is_file2sample, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__518)); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 4366, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
__Pyx_CyFunction_SetAnnotationsDict(__pyx_t_43, __pyx_t_40);
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
if (PyDict_SetItem(__pyx_d, __pyx_n_s_is_file2sample, __pyx_t_43) < 0) __PYX_ERR(0, 4366, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
/* … */
__pyx_codeobj__518 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__56, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_is_file2sample, 4366, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__518)) __PYX_ERR(0, 4366, __pyx_L1_error)
4367: """
4368: returns True if gen is a file2sample.
4369:
4370: :param gen: gen
4371: :rtype: bool
4372: """
+4373: return cclm.mus_is_file_to_sample(gen._ptr)
__pyx_r = mus_is_file_to_sample(__pyx_v_gen->_ptr); goto __pyx_L0;
4374:
4375: # ---------------- sample-to-file ---------------- #
+4376: cpdef mus_any make_sample2file(filename, chans: Optional[int]=1, sample_type: Optional[Sample]=None, header_type: Optional[Header]=None, comment: Optional[str]=None):
static PyObject *__pyx_pw_8pysndlib_3clm_459make_sample2file(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_f_8pysndlib_3clm_make_sample2file(PyObject *__pyx_v_filename, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_8pysndlib_3clm_make_sample2file *__pyx_optional_args) {
PyObject *__pyx_v_chans = ((PyObject *)__pyx_int_1);
PyObject *__pyx_v_sample_type = ((PyObject *)Py_None);
PyObject *__pyx_v_header_type = ((PyObject *)Py_None);
PyObject *__pyx_v_comment = ((PyObject *)Py_None);
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_r = NULL;
if (__pyx_optional_args) {
if (__pyx_optional_args->__pyx_n > 0) {
__pyx_v_chans = __pyx_optional_args->chans;
if (__pyx_optional_args->__pyx_n > 1) {
__pyx_v_sample_type = __pyx_optional_args->sample_type;
if (__pyx_optional_args->__pyx_n > 2) {
__pyx_v_header_type = __pyx_optional_args->header_type;
if (__pyx_optional_args->__pyx_n > 3) {
__pyx_v_comment = __pyx_optional_args->comment;
}
}
}
}
}
__Pyx_INCREF(__pyx_v_sample_type);
__Pyx_INCREF(__pyx_v_header_type);
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_AddTraceback("pysndlib.clm.make_sample2file", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XDECREF(__pyx_v_sample_type);
__Pyx_XDECREF(__pyx_v_header_type);
__Pyx_XGIVEREF((PyObject *)__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_459make_sample2file(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_458make_sample2file, "\n return an output generator writing the sound file 'filename' which is set up to have chans'\n channels of 'sample_type' samples with a header of 'header_type'. the latter should be sndlib\n identifiers.\n \n :param filename: name of file to write\n :param chans: number of channels\n :param sample_type: sample type of file\n :param header_type: header type of file\n :return: sample2file gen\n :rtype: mus_any\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_459make_sample2file = {"make_sample2file", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_459make_sample2file, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_458make_sample2file};
static PyObject *__pyx_pw_8pysndlib_3clm_459make_sample2file(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
PyObject *__pyx_v_filename = 0;
PyObject *__pyx_v_chans = 0;
PyObject *__pyx_v_sample_type = 0;
PyObject *__pyx_v_header_type = 0;
PyObject *__pyx_v_comment = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("make_sample2file (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_filename,&__pyx_n_s_chans,&__pyx_n_s_sample_type,&__pyx_n_s_header_type,&__pyx_n_s_comment,0};
PyObject* values[5] = {0,0,0,0,0};
values[1] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)__pyx_int_1));
values[2] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
values[3] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
values[4] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4);
CYTHON_FALLTHROUGH;
case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
CYTHON_FALLTHROUGH;
case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_filename)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4376, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_chans);
if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4376, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 2:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_sample_type);
if (value) { values[2] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4376, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 3:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_header_type);
if (value) { values[3] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4376, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 4:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_comment);
if (value) { values[4] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4376, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "make_sample2file") < 0)) __PYX_ERR(0, 4376, __pyx_L3_error)
}
} else {
switch (__pyx_nargs) {
case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4);
CYTHON_FALLTHROUGH;
case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
CYTHON_FALLTHROUGH;
case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
break;
default: goto __pyx_L5_argtuple_error;
}
}
__pyx_v_filename = values[0];
__pyx_v_chans = values[1];
__pyx_v_sample_type = values[2];
__pyx_v_header_type = values[3];
__pyx_v_comment = values[4];
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("make_sample2file", 0, 1, 5, __pyx_nargs); __PYX_ERR(0, 4376, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.make_sample2file", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_8pysndlib_3clm_458make_sample2file(__pyx_self, __pyx_v_filename, __pyx_v_chans, __pyx_v_sample_type, __pyx_v_header_type, __pyx_v_comment);
/* function exit code */
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_458make_sample2file(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_filename, PyObject *__pyx_v_chans, PyObject *__pyx_v_sample_type, PyObject *__pyx_v_header_type, PyObject *__pyx_v_comment) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_2.__pyx_n = 4;
__pyx_t_2.chans = __pyx_v_chans;
__pyx_t_2.sample_type = __pyx_v_sample_type;
__pyx_t_2.header_type = __pyx_v_header_type;
__pyx_t_2.comment = __pyx_v_comment;
__pyx_t_1 = ((PyObject *)__pyx_f_8pysndlib_3clm_make_sample2file(__pyx_v_filename, 0, &__pyx_t_2)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4376, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("pysndlib.clm.make_sample2file", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_tuple__519 = PyTuple_Pack(5, __pyx_n_s_filename, __pyx_n_s_chans, __pyx_n_s_sample_type, __pyx_n_s_header_type, __pyx_n_s_comment); if (unlikely(!__pyx_tuple__519)) __PYX_ERR(0, 4376, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__519);
__Pyx_GIVEREF(__pyx_tuple__519);
__pyx_codeobj__520 = (PyObject*)__Pyx_PyCode_New(5, 0, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__519, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_make_sample2file, 4376, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__520)) __PYX_ERR(0, 4376, __pyx_L1_error)
/* … */
__pyx_t_43 = __Pyx_PyDict_NewPresized(4); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 4376, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
if (PyDict_SetItem(__pyx_t_43, __pyx_n_s_chans, __pyx_kp_s_Optional_int) < 0) __PYX_ERR(0, 4376, __pyx_L1_error)
if (PyDict_SetItem(__pyx_t_43, __pyx_n_s_sample_type, __pyx_kp_s_Optional_Sample) < 0) __PYX_ERR(0, 4376, __pyx_L1_error)
if (PyDict_SetItem(__pyx_t_43, __pyx_n_s_header_type, __pyx_kp_s_Optional_Header) < 0) __PYX_ERR(0, 4376, __pyx_L1_error)
if (PyDict_SetItem(__pyx_t_43, __pyx_n_s_comment, __pyx_kp_s_Optional_str) < 0) __PYX_ERR(0, 4376, __pyx_L1_error)
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_459make_sample2file, 0, __pyx_n_s_make_sample2file, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__520)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 4376, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
__Pyx_CyFunction_SetDefaultsTuple(__pyx_t_40, __pyx_tuple__521);
__Pyx_CyFunction_SetAnnotationsDict(__pyx_t_40, __pyx_t_43);
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
if (PyDict_SetItem(__pyx_d, __pyx_n_s_make_sample2file, __pyx_t_40) < 0) __PYX_ERR(0, 4376, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
__pyx_tuple__521 = PyTuple_Pack(4, __pyx_int_1, Py_None, Py_None, Py_None); if (unlikely(!__pyx_tuple__521)) __PYX_ERR(0, 4376, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__521);
__Pyx_GIVEREF(__pyx_tuple__521);
/* … */
struct __pyx_opt_args_8pysndlib_3clm_make_sample2file {
int __pyx_n;
PyObject *chans;
PyObject *sample_type;
PyObject *header_type;
PyObject *comment;
};
4377: """
4378: return an output generator writing the sound file 'filename' which is set up to have chans'
4379: channels of 'sample_type' samples with a header of 'header_type'. the latter should be sndlib
4380: identifiers.
4381:
4382: :param filename: name of file to write
4383: :param chans: number of channels
4384: :param sample_type: sample type of file
4385: :param header_type: header type of file
4386: :return: sample2file gen
4387: :rtype: mus_any
4388: """
+4389: sample_type = sample_type or CLM.sample_type
__pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_sample_type); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 4389, __pyx_L1_error) if (!__pyx_t_2) { } else { __Pyx_INCREF(__pyx_v_sample_type); __pyx_t_1 = __pyx_v_sample_type; goto __pyx_L3_bool_binop_done; } __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_CLM); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4389, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_sample_type); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4389, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_INCREF(__pyx_t_4); __pyx_t_1 = __pyx_t_4; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_L3_bool_binop_done:; __Pyx_DECREF_SET(__pyx_v_sample_type, __pyx_t_1); __pyx_t_1 = 0;
+4390: header_type = header_type or CLM.header_type
__pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_header_type); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 4390, __pyx_L1_error) if (!__pyx_t_2) { } else { __Pyx_INCREF(__pyx_v_header_type); __pyx_t_1 = __pyx_v_header_type; goto __pyx_L5_bool_binop_done; } __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_CLM); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4390, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_header_type); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4390, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_INCREF(__pyx_t_3); __pyx_t_1 = __pyx_t_3; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_L5_bool_binop_done:; __Pyx_DECREF_SET(__pyx_v_header_type, __pyx_t_1); __pyx_t_1 = 0;
+4391: if comment is None:
__pyx_t_2 = (__pyx_v_comment == Py_None);
if (__pyx_t_2) {
/* … */
}
+4392: return mus_any.from_ptr(cclm.mus_make_sample_to_file_with_comment(filename, chans, sample_type, header_type, NULL))
__Pyx_XDECREF((PyObject *)__pyx_r); __pyx_t_5 = __Pyx_PyObject_AsString(__pyx_v_filename); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) __PYX_ERR(0, 4392, __pyx_L1_error) __pyx_t_6 = __Pyx_PyInt_As_int(__pyx_v_chans); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 4392, __pyx_L1_error) __pyx_t_7 = ((mus_sample_t)__Pyx_PyInt_As_mus_sample_t(__pyx_v_sample_type)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4392, __pyx_L1_error) __pyx_t_8 = ((mus_header_t)__Pyx_PyInt_As_mus_header_t(__pyx_v_header_type)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4392, __pyx_L1_error) __pyx_t_1 = ((PyObject *)__pyx_vtabptr_8pysndlib_3clm_mus_any->from_ptr(mus_make_sample_to_file_with_comment(__pyx_t_5, __pyx_t_6, __pyx_t_7, __pyx_t_8, NULL), NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4392, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0;
4393: else:
+4394: return mus_any.from_ptr(cclm.mus_make_sample_to_file_with_comment(filename, chans, sample_type, header_type, comment))
/*else*/ {
__Pyx_XDECREF((PyObject *)__pyx_r);
__pyx_t_5 = __Pyx_PyObject_AsString(__pyx_v_filename); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) __PYX_ERR(0, 4394, __pyx_L1_error)
__pyx_t_6 = __Pyx_PyInt_As_int(__pyx_v_chans); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 4394, __pyx_L1_error)
__pyx_t_7 = ((mus_sample_t)__Pyx_PyInt_As_mus_sample_t(__pyx_v_sample_type)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4394, __pyx_L1_error)
__pyx_t_8 = ((mus_header_t)__Pyx_PyInt_As_mus_header_t(__pyx_v_header_type)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4394, __pyx_L1_error)
__pyx_t_9 = __Pyx_PyObject_AsString(__pyx_v_comment); if (unlikely((!__pyx_t_9) && PyErr_Occurred())) __PYX_ERR(0, 4394, __pyx_L1_error)
__pyx_t_1 = ((PyObject *)__pyx_vtabptr_8pysndlib_3clm_mus_any->from_ptr(mus_make_sample_to_file_with_comment(__pyx_t_5, __pyx_t_6, __pyx_t_7, __pyx_t_8, __pyx_t_9), NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4394, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_t_1);
__pyx_t_1 = 0;
goto __pyx_L0;
}
4395:
+4396: cpdef cython.double sample2file(gen: mus_any, samp: int, chan:int , val: cython.double):
static PyObject *__pyx_pw_8pysndlib_3clm_461sample2file(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static double __pyx_f_8pysndlib_3clm_sample2file(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, PyObject *__pyx_v_samp, PyObject *__pyx_v_chan, double __pyx_v_val, CYTHON_UNUSED int __pyx_skip_dispatch) {
double __pyx_r;
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_AddTraceback("pysndlib.clm.sample2file", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = -1;
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_461sample2file(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_460sample2file, "\n add val to the output stream handled by the output generator 'obj', \\in channel 'chan' at frample 'samp'.\n \n :param gen: sample2file gem\n :param samp: location \\in file to write\n :param chan: channel to write\n :param val: sample value to write\n :rtype: float\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_461sample2file = {"sample2file", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_461sample2file, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_460sample2file};
static PyObject *__pyx_pw_8pysndlib_3clm_461sample2file(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = 0;
PyObject *__pyx_v_samp = 0;
PyObject *__pyx_v_chan = 0;
double __pyx_v_val;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("sample2file (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gen,&__pyx_n_s_samp,&__pyx_n_s_chan,&__pyx_n_s_val,0};
PyObject* values[4] = {0,0,0,0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
CYTHON_FALLTHROUGH;
case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_gen)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4396, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_samp)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4396, __pyx_L3_error)
else {
__Pyx_RaiseArgtupleInvalid("sample2file", 1, 4, 4, 1); __PYX_ERR(0, 4396, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 2:
if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_chan)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[2]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4396, __pyx_L3_error)
else {
__Pyx_RaiseArgtupleInvalid("sample2file", 1, 4, 4, 2); __PYX_ERR(0, 4396, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 3:
if (likely((values[3] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_val)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[3]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4396, __pyx_L3_error)
else {
__Pyx_RaiseArgtupleInvalid("sample2file", 1, 4, 4, 3); __PYX_ERR(0, 4396, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "sample2file") < 0)) __PYX_ERR(0, 4396, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 4)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
}
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)values[0]);
__pyx_v_samp = ((PyObject*)values[1]);
__pyx_v_chan = ((PyObject*)values[2]);
__pyx_v_val = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_val == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 4396, __pyx_L3_error)
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("sample2file", 1, 4, 4, __pyx_nargs); __PYX_ERR(0, 4396, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.sample2file", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gen), __pyx_ptype_8pysndlib_3clm_mus_any, 0, "gen", 0))) __PYX_ERR(0, 4396, __pyx_L1_error)
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_samp), (&PyInt_Type), 0, "samp", 1))) __PYX_ERR(0, 4396, __pyx_L1_error)
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_chan), (&PyInt_Type), 0, "chan", 1))) __PYX_ERR(0, 4396, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_460sample2file(__pyx_self, __pyx_v_gen, __pyx_v_samp, __pyx_v_chan, __pyx_v_val);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_460sample2file(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, PyObject *__pyx_v_samp, PyObject *__pyx_v_chan, double __pyx_v_val) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8pysndlib_3clm_sample2file(__pyx_v_gen, __pyx_v_samp, __pyx_v_chan, __pyx_v_val, 0); if (unlikely(__pyx_t_1 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 4396, __pyx_L1_error)
__pyx_t_2 = PyFloat_FromDouble(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4396, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("pysndlib.clm.sample2file", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_tuple__522 = PyTuple_Pack(4, __pyx_n_s_gen, __pyx_n_s_samp, __pyx_n_s_chan, __pyx_n_s_val); if (unlikely(!__pyx_tuple__522)) __PYX_ERR(0, 4396, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__522);
__Pyx_GIVEREF(__pyx_tuple__522);
/* … */
__pyx_t_40 = __Pyx_PyDict_NewPresized(4); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 4396, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
if (PyDict_SetItem(__pyx_t_40, __pyx_n_s_gen, __pyx_n_s_mus_any) < 0) __PYX_ERR(0, 4396, __pyx_L1_error)
if (PyDict_SetItem(__pyx_t_40, __pyx_n_s_samp, __pyx_n_s_int_2) < 0) __PYX_ERR(0, 4396, __pyx_L1_error)
if (PyDict_SetItem(__pyx_t_40, __pyx_n_s_chan, __pyx_n_s_int_2) < 0) __PYX_ERR(0, 4396, __pyx_L1_error)
if (PyDict_SetItem(__pyx_t_40, __pyx_n_s_val, __pyx_kp_s_cython_double) < 0) __PYX_ERR(0, 4396, __pyx_L1_error)
__pyx_t_43 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_461sample2file, 0, __pyx_n_s_sample2file, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__523)); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 4396, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
__Pyx_CyFunction_SetAnnotationsDict(__pyx_t_43, __pyx_t_40);
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
if (PyDict_SetItem(__pyx_d, __pyx_n_s_sample2file, __pyx_t_43) < 0) __PYX_ERR(0, 4396, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
__pyx_codeobj__523 = (PyObject*)__Pyx_PyCode_New(4, 0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__522, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_sample2file, 4396, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__523)) __PYX_ERR(0, 4396, __pyx_L1_error)
4397: """
4398: add val to the output stream handled by the output generator 'obj', \in channel 'chan' at frample 'samp'.
4399:
4400: :param gen: sample2file gem
4401: :param samp: location \in file to write
4402: :param chan: channel to write
4403: :param val: sample value to write
4404: :rtype: float
4405: """
+4406: return cclm.mus_sample_to_file(gen._ptr, samp, chan, val)
__pyx_t_1 = __Pyx_PyInt_As_int64_t(__pyx_v_samp); if (unlikely((__pyx_t_1 == ((mus_long_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 4406, __pyx_L1_error) __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_v_chan); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 4406, __pyx_L1_error) __pyx_r = mus_sample_to_file(__pyx_v_gen->_ptr, __pyx_t_1, __pyx_t_2, __pyx_v_val); goto __pyx_L0;
4407:
+4408: cpdef bint is_sample2file(gen: mus_any):
static PyObject *__pyx_pw_8pysndlib_3clm_463is_sample2file(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static int __pyx_f_8pysndlib_3clm_is_sample2file(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, CYTHON_UNUSED int __pyx_skip_dispatch) {
int __pyx_r;
/* … */
/* function exit code */
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_463is_sample2file(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_462is_sample2file, "\n returns True if gen is a sample2file.\n \n :param gen: gen\n :rtype: bool\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_463is_sample2file = {"is_sample2file", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_463is_sample2file, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_462is_sample2file};
static PyObject *__pyx_pw_8pysndlib_3clm_463is_sample2file(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("is_sample2file (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gen,0};
PyObject* values[1] = {0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_gen)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4408, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "is_sample2file") < 0)) __PYX_ERR(0, 4408, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 1)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
}
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)values[0]);
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("is_sample2file", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 4408, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.is_sample2file", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gen), __pyx_ptype_8pysndlib_3clm_mus_any, 0, "gen", 0))) __PYX_ERR(0, 4408, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_462is_sample2file(__pyx_self, __pyx_v_gen);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_462is_sample2file(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8pysndlib_3clm_is_sample2file(__pyx_v_gen, 0); if (unlikely(__pyx_t_1 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 4408, __pyx_L1_error)
__pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4408, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("pysndlib.clm.is_sample2file", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_43 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 4408, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
if (PyDict_SetItem(__pyx_t_43, __pyx_n_s_gen, __pyx_n_s_mus_any) < 0) __PYX_ERR(0, 4408, __pyx_L1_error)
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_463is_sample2file, 0, __pyx_n_s_is_sample2file, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__524)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 4408, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
__Pyx_CyFunction_SetAnnotationsDict(__pyx_t_40, __pyx_t_43);
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
if (PyDict_SetItem(__pyx_d, __pyx_n_s_is_sample2file, __pyx_t_40) < 0) __PYX_ERR(0, 4408, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
/* … */
__pyx_codeobj__524 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__56, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_is_sample2file, 4408, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__524)) __PYX_ERR(0, 4408, __pyx_L1_error)
4409: """
4410: returns True if gen is a sample2file.
4411:
4412: :param gen: gen
4413: :rtype: bool
4414: """
+4415: return cclm.mus_is_sample_to_file(gen._ptr)
__pyx_r = mus_is_sample_to_file(__pyx_v_gen->_ptr); goto __pyx_L0;
4416:
+4417: cpdef mus_any continue_sample2file(name: str):
static PyObject *__pyx_pw_8pysndlib_3clm_465continue_sample2file(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_f_8pysndlib_3clm_continue_sample2file(PyObject *__pyx_v_name, CYTHON_UNUSED int __pyx_skip_dispatch) {
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_r = NULL;
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("pysndlib.clm.continue_sample2file", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XGIVEREF((PyObject *)__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_465continue_sample2file(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_464continue_sample2file, "\n reopen an existing file to continue adding sound data to it.\n \n :param filename: name of file to write\n :return: file2sample gen\n :rtype: mus_any\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_465continue_sample2file = {"continue_sample2file", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_465continue_sample2file, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_464continue_sample2file};
static PyObject *__pyx_pw_8pysndlib_3clm_465continue_sample2file(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
PyObject *__pyx_v_name = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("continue_sample2file (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_name,0};
PyObject* values[1] = {0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_name)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4417, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "continue_sample2file") < 0)) __PYX_ERR(0, 4417, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 1)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
}
__pyx_v_name = ((PyObject*)values[0]);
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("continue_sample2file", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 4417, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.continue_sample2file", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_name), (&PyString_Type), 0, "name", 1))) __PYX_ERR(0, 4417, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_464continue_sample2file(__pyx_self, __pyx_v_name);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_464continue_sample2file(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_name) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = ((PyObject *)__pyx_f_8pysndlib_3clm_continue_sample2file(__pyx_v_name, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4417, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("pysndlib.clm.continue_sample2file", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_tuple__525 = PyTuple_Pack(1, __pyx_n_s_name); if (unlikely(!__pyx_tuple__525)) __PYX_ERR(0, 4417, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__525);
__Pyx_GIVEREF(__pyx_tuple__525);
/* … */
__pyx_t_40 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 4417, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
if (PyDict_SetItem(__pyx_t_40, __pyx_n_s_name, __pyx_n_s_str_2) < 0) __PYX_ERR(0, 4417, __pyx_L1_error)
__pyx_t_43 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_465continue_sample2file, 0, __pyx_n_s_continue_sample2file, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__526)); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 4417, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
__Pyx_CyFunction_SetAnnotationsDict(__pyx_t_43, __pyx_t_40);
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
if (PyDict_SetItem(__pyx_d, __pyx_n_s_continue_sample2file, __pyx_t_43) < 0) __PYX_ERR(0, 4417, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
__pyx_codeobj__526 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__525, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_continue_sample2file, 4417, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__526)) __PYX_ERR(0, 4417, __pyx_L1_error)
4418: """
4419: reopen an existing file to continue adding sound data to it.
4420:
4421: :param filename: name of file to write
4422: :return: file2sample gen
4423: :rtype: mus_any
4424: """
+4425: return mus_any.from_ptr(cclm.mus_continue_sample_to_file(name))
__Pyx_XDECREF((PyObject *)__pyx_r); __pyx_t_1 = __Pyx_PyObject_AsString(__pyx_v_name); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) __PYX_ERR(0, 4425, __pyx_L1_error) __pyx_t_2 = ((PyObject *)__pyx_vtabptr_8pysndlib_3clm_mus_any->from_ptr(mus_continue_sample_to_file(__pyx_t_1), NULL)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4425, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_r = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_t_2); __pyx_t_2 = 0; goto __pyx_L0;
4426:
4427:
4428: # ---------------- file-to-frample ---------------- #
+4429: cpdef mus_any make_file2frample(filename, buffer_size: Optional[int]=None):
static PyObject *__pyx_pw_8pysndlib_3clm_467make_file2frample(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_f_8pysndlib_3clm_make_file2frample(PyObject *__pyx_v_filename, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_8pysndlib_3clm_make_file2frample *__pyx_optional_args) {
PyObject *__pyx_v_buffer_size = ((PyObject *)Py_None);
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_r = NULL;
if (__pyx_optional_args) {
if (__pyx_optional_args->__pyx_n > 0) {
__pyx_v_buffer_size = __pyx_optional_args->buffer_size;
}
}
__Pyx_INCREF(__pyx_v_buffer_size);
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_AddTraceback("pysndlib.clm.make_file2frample", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XDECREF(__pyx_v_buffer_size);
__Pyx_XGIVEREF((PyObject *)__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_467make_file2frample(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_466make_file2frample, "\n return an input generator reading all channels of 'filename' (a sound file).\n \n :param filename: name of file to read\n :param buffer_size: io buffer size\n :return: file2frample gen\n :rtype: mus_any\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_467make_file2frample = {"make_file2frample", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_467make_file2frample, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_466make_file2frample};
static PyObject *__pyx_pw_8pysndlib_3clm_467make_file2frample(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
PyObject *__pyx_v_filename = 0;
PyObject *__pyx_v_buffer_size = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("make_file2frample (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_filename,&__pyx_n_s_buffer_size,0};
PyObject* values[2] = {0,0};
values[1] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_filename)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4429, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_buffer_size);
if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4429, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "make_file2frample") < 0)) __PYX_ERR(0, 4429, __pyx_L3_error)
}
} else {
switch (__pyx_nargs) {
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
break;
default: goto __pyx_L5_argtuple_error;
}
}
__pyx_v_filename = values[0];
__pyx_v_buffer_size = values[1];
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("make_file2frample", 0, 1, 2, __pyx_nargs); __PYX_ERR(0, 4429, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.make_file2frample", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_8pysndlib_3clm_466make_file2frample(__pyx_self, __pyx_v_filename, __pyx_v_buffer_size);
/* function exit code */
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_466make_file2frample(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_filename, PyObject *__pyx_v_buffer_size) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_2.__pyx_n = 1;
__pyx_t_2.buffer_size = __pyx_v_buffer_size;
__pyx_t_1 = ((PyObject *)__pyx_f_8pysndlib_3clm_make_file2frample(__pyx_v_filename, 0, &__pyx_t_2)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4429, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("pysndlib.clm.make_file2frample", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_43 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 4429, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
if (PyDict_SetItem(__pyx_t_43, __pyx_n_s_buffer_size, __pyx_kp_s_Optional_int) < 0) __PYX_ERR(0, 4429, __pyx_L1_error)
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_467make_file2frample, 0, __pyx_n_s_make_file2frample, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__527)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 4429, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
__Pyx_CyFunction_SetDefaultsTuple(__pyx_t_40, __pyx_tuple__90);
__Pyx_CyFunction_SetAnnotationsDict(__pyx_t_40, __pyx_t_43);
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
if (PyDict_SetItem(__pyx_d, __pyx_n_s_make_file2frample, __pyx_t_40) < 0) __PYX_ERR(0, 4429, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
/* … */
__pyx_codeobj__527 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__514, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_make_file2frample, 4429, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__527)) __PYX_ERR(0, 4429, __pyx_L1_error)
/* … */
struct __pyx_opt_args_8pysndlib_3clm_make_file2frample {
int __pyx_n;
PyObject *buffer_size;
};
4430: """
4431: return an input generator reading all channels of 'filename' (a sound file).
4432:
4433: :param filename: name of file to read
4434: :param buffer_size: io buffer size
4435: :return: file2frample gen
4436: :rtype: mus_any
4437: """
+4438: buffer_size = buffer_size or CLM.buffer_size
__pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_buffer_size); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 4438, __pyx_L1_error) if (!__pyx_t_2) { } else { __Pyx_INCREF(__pyx_v_buffer_size); __pyx_t_1 = __pyx_v_buffer_size; goto __pyx_L3_bool_binop_done; } __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_CLM); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4438, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_buffer_size); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4438, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_INCREF(__pyx_t_4); __pyx_t_1 = __pyx_t_4; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_L3_bool_binop_done:; __Pyx_DECREF_SET(__pyx_v_buffer_size, __pyx_t_1); __pyx_t_1 = 0;
+4439: if not os.path.isfile(filename):
__Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_os); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4439, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_path); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4439, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_isfile); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4439, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = NULL; __pyx_t_5 = 0; #if CYTHON_UNPACK_METHODS if (likely(PyMethod_Check(__pyx_t_4))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_4, function); __pyx_t_5 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v_filename}; __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4439, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 4439, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_6 = (!__pyx_t_2); if (unlikely(__pyx_t_6)) { /* … */ }
+4440: raise FileNotFoundError(f'file2frample: {filename} does not exist.')
__Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_FileNotFoundError); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4440, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4440, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_7 = 0; __pyx_t_8 = 127; __Pyx_INCREF(__pyx_kp_u_file2frample); __pyx_t_7 += 14; __Pyx_GIVEREF(__pyx_kp_u_file2frample); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_kp_u_file2frample); __pyx_t_3 = __Pyx_PyObject_FormatSimple(__pyx_v_filename, __pyx_empty_unicode); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4440, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_8 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3) > __pyx_t_8) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3) : __pyx_t_8; __pyx_t_7 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3); __pyx_t_3 = 0; __Pyx_INCREF(__pyx_kp_u_does_not_exist); __pyx_t_7 += 16; __Pyx_GIVEREF(__pyx_kp_u_does_not_exist); PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_kp_u_does_not_exist); __pyx_t_3 = __Pyx_PyUnicode_Join(__pyx_t_4, 3, __pyx_t_7, __pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4440, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4440, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __PYX_ERR(0, 4440, __pyx_L1_error)
+4441: return mus_any.from_ptr(cclm.mus_make_file_to_frample_with_buffer_size(filename, buffer_size))
__Pyx_XDECREF((PyObject *)__pyx_r); __pyx_t_9 = __Pyx_PyObject_AsString(__pyx_v_filename); if (unlikely((!__pyx_t_9) && PyErr_Occurred())) __PYX_ERR(0, 4441, __pyx_L1_error) __pyx_t_10 = __Pyx_PyInt_As_int64_t(__pyx_v_buffer_size); if (unlikely((__pyx_t_10 == ((mus_long_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 4441, __pyx_L1_error) __pyx_t_4 = ((PyObject *)__pyx_vtabptr_8pysndlib_3clm_mus_any->from_ptr(mus_make_file_to_frample_with_buffer_size(__pyx_t_9, __pyx_t_10), NULL)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4441, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_r = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_t_4); __pyx_t_4 = 0; goto __pyx_L0;
4442:
+4443: cpdef file2frample(gen: mus_any, loc: int):
static PyObject *__pyx_pw_8pysndlib_3clm_469file2frample(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyObject *__pyx_f_8pysndlib_3clm_file2frample(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, PyObject *__pyx_v_loc, CYTHON_UNUSED int __pyx_skip_dispatch) {
PyObject *__pyx_v_outf = NULL;
__Pyx_memviewslice __pyx_v_outf_view = { 0, 0, { 0 }, { 0 }, { 0 } };
PyObject *__pyx_r = NULL;
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_XDECREF(__pyx_t_5);
__PYX_XCLEAR_MEMVIEW(&__pyx_t_6, 1);
__Pyx_AddTraceback("pysndlib.clm.file2frample", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XDECREF(__pyx_v_outf);
__PYX_XCLEAR_MEMVIEW(&__pyx_v_outf_view, 1);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_469file2frample(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_468file2frample, "\n frample of samples at frample 'samp' \\in sound file read by 'obj'.\n \n :param gen: file2frample gen\n :param loc: location \\in file to read\n :rtype: np.ndarray\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_469file2frample = {"file2frample", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_469file2frample, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_468file2frample};
static PyObject *__pyx_pw_8pysndlib_3clm_469file2frample(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = 0;
PyObject *__pyx_v_loc = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("file2frample (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gen,&__pyx_n_s_loc,0};
PyObject* values[2] = {0,0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_gen)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4443, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_loc)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4443, __pyx_L3_error)
else {
__Pyx_RaiseArgtupleInvalid("file2frample", 1, 2, 2, 1); __PYX_ERR(0, 4443, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "file2frample") < 0)) __PYX_ERR(0, 4443, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 2)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
}
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)values[0]);
__pyx_v_loc = ((PyObject*)values[1]);
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("file2frample", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 4443, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.file2frample", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gen), __pyx_ptype_8pysndlib_3clm_mus_any, 0, "gen", 0))) __PYX_ERR(0, 4443, __pyx_L1_error)
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_loc), (&PyInt_Type), 0, "loc", 1))) __PYX_ERR(0, 4443, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_468file2frample(__pyx_self, __pyx_v_gen, __pyx_v_loc);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_468file2frample(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, PyObject *__pyx_v_loc) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8pysndlib_3clm_file2frample(__pyx_v_gen, __pyx_v_loc, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4443, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("pysndlib.clm.file2frample", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_tuple__528 = PyTuple_Pack(2, __pyx_n_s_gen, __pyx_n_s_loc); if (unlikely(!__pyx_tuple__528)) __PYX_ERR(0, 4443, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__528);
__Pyx_GIVEREF(__pyx_tuple__528);
/* … */
__pyx_t_40 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 4443, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
if (PyDict_SetItem(__pyx_t_40, __pyx_n_s_gen, __pyx_n_s_mus_any) < 0) __PYX_ERR(0, 4443, __pyx_L1_error)
if (PyDict_SetItem(__pyx_t_40, __pyx_n_s_loc, __pyx_n_s_int_2) < 0) __PYX_ERR(0, 4443, __pyx_L1_error)
__pyx_t_43 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_469file2frample, 0, __pyx_n_s_file2frample_2, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__529)); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 4443, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
__Pyx_CyFunction_SetAnnotationsDict(__pyx_t_43, __pyx_t_40);
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
if (PyDict_SetItem(__pyx_d, __pyx_n_s_file2frample_2, __pyx_t_43) < 0) __PYX_ERR(0, 4443, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
__pyx_codeobj__529 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__528, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_file2frample_2, 4443, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__529)) __PYX_ERR(0, 4443, __pyx_L1_error)
4444: """
4445: frample of samples at frample 'samp' \in sound file read by 'obj'.
4446:
4447: :param gen: file2frample gen
4448: :param loc: location \in file to read
4449: :rtype: np.ndarray
4450: """
+4451: outf = np.zeros(cclm.mus_channels(gen._ptr), dtype=np.double)
__Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4451, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_zeros); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4451, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_PyInt_From_int(mus_channels(__pyx_v_gen->_ptr)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4451, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4451, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_GIVEREF(__pyx_t_1); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1)) __PYX_ERR(0, 4451, __pyx_L1_error); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4451, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4451, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_double); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4451, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_t_5) < 0) __PYX_ERR(0, 4451, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4451, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_outf = __pyx_t_5; __pyx_t_5 = 0;
+4452: cdef double [:] outf_view = outf
__pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_v_outf, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 4452, __pyx_L1_error) __pyx_v_outf_view = __pyx_t_6; __pyx_t_6.memview = NULL; __pyx_t_6.data = NULL;
+4453: cclm.mus_file_to_frample(gen._ptr, loc, &outf_view[0])
__pyx_t_7 = __Pyx_PyInt_As_int64_t(__pyx_v_loc); if (unlikely((__pyx_t_7 == ((mus_long_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 4453, __pyx_L1_error) __pyx_t_8 = 0; __pyx_t_9 = -1; if (__pyx_t_8 < 0) { __pyx_t_8 += __pyx_v_outf_view.shape[0]; if (unlikely(__pyx_t_8 < 0)) __pyx_t_9 = 0; } else if (unlikely(__pyx_t_8 >= __pyx_v_outf_view.shape[0])) __pyx_t_9 = 0; if (unlikely(__pyx_t_9 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_9); __PYX_ERR(0, 4453, __pyx_L1_error) } (void)(mus_file_to_frample(__pyx_v_gen->_ptr, __pyx_t_7, (&(*((double *) ( /* dim=0 */ (__pyx_v_outf_view.data + __pyx_t_8 * __pyx_v_outf_view.strides[0]) ))))));
+4454: return outf
__Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_v_outf); __pyx_r = __pyx_v_outf; goto __pyx_L0;
4455:
+4456: cpdef is_file2frample(gen: mus_any):
static PyObject *__pyx_pw_8pysndlib_3clm_471is_file2frample(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyObject *__pyx_f_8pysndlib_3clm_is_file2frample(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, CYTHON_UNUSED int __pyx_skip_dispatch) {
PyObject *__pyx_r = NULL;
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("pysndlib.clm.is_file2frample", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_471is_file2frample(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_470is_file2frample, "\n returns True if gen is a file2frample.\n \n :param gen: gen\n :rtype: bool\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_471is_file2frample = {"is_file2frample", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_471is_file2frample, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_470is_file2frample};
static PyObject *__pyx_pw_8pysndlib_3clm_471is_file2frample(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("is_file2frample (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gen,0};
PyObject* values[1] = {0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_gen)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4456, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "is_file2frample") < 0)) __PYX_ERR(0, 4456, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 1)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
}
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)values[0]);
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("is_file2frample", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 4456, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.is_file2frample", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gen), __pyx_ptype_8pysndlib_3clm_mus_any, 0, "gen", 0))) __PYX_ERR(0, 4456, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_470is_file2frample(__pyx_self, __pyx_v_gen);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_470is_file2frample(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8pysndlib_3clm_is_file2frample(__pyx_v_gen, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4456, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("pysndlib.clm.is_file2frample", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_43 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 4456, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
if (PyDict_SetItem(__pyx_t_43, __pyx_n_s_gen, __pyx_n_s_mus_any) < 0) __PYX_ERR(0, 4456, __pyx_L1_error)
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_471is_file2frample, 0, __pyx_n_s_is_file2frample, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__530)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 4456, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
__Pyx_CyFunction_SetAnnotationsDict(__pyx_t_40, __pyx_t_43);
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
if (PyDict_SetItem(__pyx_d, __pyx_n_s_is_file2frample, __pyx_t_40) < 0) __PYX_ERR(0, 4456, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
/* … */
__pyx_codeobj__530 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__56, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_is_file2frample, 4456, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__530)) __PYX_ERR(0, 4456, __pyx_L1_error)
4457: """
4458: returns True if gen is a file2frample.
4459:
4460: :param gen: gen
4461: :rtype: bool
4462: """
+4463: return cclm.mus_is_file_to_frample(gen._ptr)
__Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyBool_FromLong(mus_is_file_to_frample(__pyx_v_gen->_ptr)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4463, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
4464:
4465:
4466: # ---------------- frample-to-file ---------------- #
+4467: cpdef mus_any make_frample2file(filename, chans: Optional[int]=1, sample_type: Optional[sample]=None, header_type: Optional[header]=None, comment: Optional[str]=None):
static PyObject *__pyx_pw_8pysndlib_3clm_473make_frample2file(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_f_8pysndlib_3clm_make_frample2file(PyObject *__pyx_v_filename, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_8pysndlib_3clm_make_frample2file *__pyx_optional_args) {
PyObject *__pyx_v_chans = ((PyObject *)__pyx_int_1);
PyObject *__pyx_v_sample_type = ((PyObject *)Py_None);
PyObject *__pyx_v_header_type = ((PyObject *)Py_None);
PyObject *__pyx_v_comment = ((PyObject *)Py_None);
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_r = NULL;
if (__pyx_optional_args) {
if (__pyx_optional_args->__pyx_n > 0) {
__pyx_v_chans = __pyx_optional_args->chans;
if (__pyx_optional_args->__pyx_n > 1) {
__pyx_v_sample_type = __pyx_optional_args->sample_type;
if (__pyx_optional_args->__pyx_n > 2) {
__pyx_v_header_type = __pyx_optional_args->header_type;
if (__pyx_optional_args->__pyx_n > 3) {
__pyx_v_comment = __pyx_optional_args->comment;
}
}
}
}
}
__Pyx_INCREF(__pyx_v_sample_type);
__Pyx_INCREF(__pyx_v_header_type);
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_AddTraceback("pysndlib.clm.make_frample2file", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XDECREF(__pyx_v_sample_type);
__Pyx_XDECREF(__pyx_v_header_type);
__Pyx_XGIVEREF((PyObject *)__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_473make_frample2file(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_472make_frample2file, "\n return an output generator writing the sound file 'filename' which is set up to have 'chans'\n channels of 'sample_type' samples with a header of 'header_type'. the latter should be sndlib\n identifiers. \n \n :param filename: name of file to write\n :param chans: number of channels\n :param frample2file: sample type of file\n :param header_type: header type of file\n :return: sample2file gen\n :rtype: mus_any \n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_473make_frample2file = {"make_frample2file", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_473make_frample2file, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_472make_frample2file};
static PyObject *__pyx_pw_8pysndlib_3clm_473make_frample2file(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
PyObject *__pyx_v_filename = 0;
PyObject *__pyx_v_chans = 0;
PyObject *__pyx_v_sample_type = 0;
PyObject *__pyx_v_header_type = 0;
PyObject *__pyx_v_comment = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("make_frample2file (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_filename,&__pyx_n_s_chans,&__pyx_n_s_sample_type,&__pyx_n_s_header_type,&__pyx_n_s_comment,0};
PyObject* values[5] = {0,0,0,0,0};
values[1] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)__pyx_int_1));
values[2] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
values[3] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
values[4] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4);
CYTHON_FALLTHROUGH;
case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
CYTHON_FALLTHROUGH;
case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_filename)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4467, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_chans);
if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4467, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 2:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_sample_type);
if (value) { values[2] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4467, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 3:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_header_type);
if (value) { values[3] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4467, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 4:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_comment);
if (value) { values[4] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4467, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "make_frample2file") < 0)) __PYX_ERR(0, 4467, __pyx_L3_error)
}
} else {
switch (__pyx_nargs) {
case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4);
CYTHON_FALLTHROUGH;
case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
CYTHON_FALLTHROUGH;
case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
break;
default: goto __pyx_L5_argtuple_error;
}
}
__pyx_v_filename = values[0];
__pyx_v_chans = values[1];
__pyx_v_sample_type = values[2];
__pyx_v_header_type = values[3];
__pyx_v_comment = values[4];
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("make_frample2file", 0, 1, 5, __pyx_nargs); __PYX_ERR(0, 4467, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.make_frample2file", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_8pysndlib_3clm_472make_frample2file(__pyx_self, __pyx_v_filename, __pyx_v_chans, __pyx_v_sample_type, __pyx_v_header_type, __pyx_v_comment);
/* function exit code */
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_472make_frample2file(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_filename, PyObject *__pyx_v_chans, PyObject *__pyx_v_sample_type, PyObject *__pyx_v_header_type, PyObject *__pyx_v_comment) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_2.__pyx_n = 4;
__pyx_t_2.chans = __pyx_v_chans;
__pyx_t_2.sample_type = __pyx_v_sample_type;
__pyx_t_2.header_type = __pyx_v_header_type;
__pyx_t_2.comment = __pyx_v_comment;
__pyx_t_1 = ((PyObject *)__pyx_f_8pysndlib_3clm_make_frample2file(__pyx_v_filename, 0, &__pyx_t_2)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4467, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("pysndlib.clm.make_frample2file", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_40 = __Pyx_PyDict_NewPresized(4); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 4467, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
if (PyDict_SetItem(__pyx_t_40, __pyx_n_s_chans, __pyx_kp_s_Optional_int) < 0) __PYX_ERR(0, 4467, __pyx_L1_error)
if (PyDict_SetItem(__pyx_t_40, __pyx_n_s_sample_type, __pyx_kp_s_Optional_sample) < 0) __PYX_ERR(0, 4467, __pyx_L1_error)
if (PyDict_SetItem(__pyx_t_40, __pyx_n_s_header_type, __pyx_kp_s_Optional_header) < 0) __PYX_ERR(0, 4467, __pyx_L1_error)
if (PyDict_SetItem(__pyx_t_40, __pyx_n_s_comment, __pyx_kp_s_Optional_str) < 0) __PYX_ERR(0, 4467, __pyx_L1_error)
__pyx_t_43 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_473make_frample2file, 0, __pyx_n_s_make_frample2file, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__531)); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 4467, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
__Pyx_CyFunction_SetDefaultsTuple(__pyx_t_43, __pyx_tuple__521);
__Pyx_CyFunction_SetAnnotationsDict(__pyx_t_43, __pyx_t_40);
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
if (PyDict_SetItem(__pyx_d, __pyx_n_s_make_frample2file, __pyx_t_43) < 0) __PYX_ERR(0, 4467, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
/* … */
__pyx_codeobj__531 = (PyObject*)__Pyx_PyCode_New(5, 0, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__519, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_make_frample2file, 4467, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__531)) __PYX_ERR(0, 4467, __pyx_L1_error)
/* … */
struct __pyx_opt_args_8pysndlib_3clm_make_frample2file {
int __pyx_n;
PyObject *chans;
PyObject *sample_type;
PyObject *header_type;
PyObject *comment;
};
4468: """
4469: return an output generator writing the sound file 'filename' which is set up to have 'chans'
4470: channels of 'sample_type' samples with a header of 'header_type'. the latter should be sndlib
4471: identifiers.
4472:
4473: :param filename: name of file to write
4474: :param chans: number of channels
4475: :param frample2file: sample type of file
4476: :param header_type: header type of file
4477: :return: sample2file gen
4478: :rtype: mus_any
4479: """
+4480: sample_type = sample_type or CLM.sample_type
__pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_sample_type); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 4480, __pyx_L1_error) if (!__pyx_t_2) { } else { __Pyx_INCREF(__pyx_v_sample_type); __pyx_t_1 = __pyx_v_sample_type; goto __pyx_L3_bool_binop_done; } __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_CLM); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4480, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_sample_type); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4480, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_INCREF(__pyx_t_4); __pyx_t_1 = __pyx_t_4; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_L3_bool_binop_done:; __Pyx_DECREF_SET(__pyx_v_sample_type, __pyx_t_1); __pyx_t_1 = 0;
+4481: header_type = header_type or CLM.header_type
__pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_header_type); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 4481, __pyx_L1_error) if (!__pyx_t_2) { } else { __Pyx_INCREF(__pyx_v_header_type); __pyx_t_1 = __pyx_v_header_type; goto __pyx_L5_bool_binop_done; } __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_CLM); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4481, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_header_type); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4481, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_INCREF(__pyx_t_3); __pyx_t_1 = __pyx_t_3; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_L5_bool_binop_done:; __Pyx_DECREF_SET(__pyx_v_header_type, __pyx_t_1); __pyx_t_1 = 0;
+4482: if comment:
__pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_comment); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 4482, __pyx_L1_error) if (__pyx_t_2) { /* … */ }
+4483: return mus_any.from_ptr(cclm.mus_make_frample_to_file_with_comment(filename, chans, sample_type, header_type, comment))
__Pyx_XDECREF((PyObject *)__pyx_r); __pyx_t_5 = __Pyx_PyObject_AsString(__pyx_v_filename); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) __PYX_ERR(0, 4483, __pyx_L1_error) __pyx_t_6 = __Pyx_PyInt_As_int(__pyx_v_chans); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 4483, __pyx_L1_error) __pyx_t_7 = ((mus_sample_t)__Pyx_PyInt_As_mus_sample_t(__pyx_v_sample_type)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4483, __pyx_L1_error) __pyx_t_8 = ((mus_header_t)__Pyx_PyInt_As_mus_header_t(__pyx_v_header_type)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4483, __pyx_L1_error) __pyx_t_9 = __Pyx_PyObject_AsString(__pyx_v_comment); if (unlikely((!__pyx_t_9) && PyErr_Occurred())) __PYX_ERR(0, 4483, __pyx_L1_error) __pyx_t_1 = ((PyObject *)__pyx_vtabptr_8pysndlib_3clm_mus_any->from_ptr(mus_make_frample_to_file_with_comment(__pyx_t_5, __pyx_t_6, __pyx_t_7, __pyx_t_8, __pyx_t_9), NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4483, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0;
4484: else:
+4485: return mus_any.from_ptr(cclm.mus_make_frample_to_file_with_comment(filename, chans, sample_type, header_type, NULL))
/*else*/ {
__Pyx_XDECREF((PyObject *)__pyx_r);
__pyx_t_5 = __Pyx_PyObject_AsString(__pyx_v_filename); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) __PYX_ERR(0, 4485, __pyx_L1_error)
__pyx_t_6 = __Pyx_PyInt_As_int(__pyx_v_chans); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 4485, __pyx_L1_error)
__pyx_t_7 = ((mus_sample_t)__Pyx_PyInt_As_mus_sample_t(__pyx_v_sample_type)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4485, __pyx_L1_error)
__pyx_t_8 = ((mus_header_t)__Pyx_PyInt_As_mus_header_t(__pyx_v_header_type)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4485, __pyx_L1_error)
__pyx_t_1 = ((PyObject *)__pyx_vtabptr_8pysndlib_3clm_mus_any->from_ptr(mus_make_frample_to_file_with_comment(__pyx_t_5, __pyx_t_6, __pyx_t_7, __pyx_t_8, NULL), NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4485, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_t_1);
__pyx_t_1 = 0;
goto __pyx_L0;
}
4486:
+4487: cpdef cython.double frample2file(gen: mus_any, samp: int, vals):
static PyObject *__pyx_pw_8pysndlib_3clm_475frample2file(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static double __pyx_f_8pysndlib_3clm_frample2file(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, PyObject *__pyx_v_samp, PyObject *__pyx_v_vals, CYTHON_UNUSED int __pyx_skip_dispatch) {
__Pyx_memviewslice __pyx_v_val_view = { 0, 0, { 0 }, { 0 }, { 0 } };
__Pyx_memviewslice __pyx_v_frample = { 0, 0, { 0 }, { 0 }, { 0 } };
double __pyx_r;
__Pyx_INCREF(__pyx_v_vals);
/* … */
/* function exit code */
__pyx_L1_error:;
__PYX_XCLEAR_MEMVIEW(&__pyx_t_1, 1);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_XDECREF(__pyx_t_5);
__Pyx_AddTraceback("pysndlib.clm.frample2file", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = -1;
__pyx_L0:;
__PYX_XCLEAR_MEMVIEW(&__pyx_v_val_view, 1);
__PYX_XCLEAR_MEMVIEW(&__pyx_v_frample, 1);
__Pyx_XDECREF(__pyx_v_vals);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_475frample2file(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_474frample2file, "\n add frample 'val' to the output stream handled by the output generator 'obj' at frample 'samp'.\n \n :param gen: frample2file gem\n :param samp: location \\in file to write\n :param vals: sample value to write. list or np.ndarray\n :rtype: float\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_475frample2file = {"frample2file", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_475frample2file, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_474frample2file};
static PyObject *__pyx_pw_8pysndlib_3clm_475frample2file(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = 0;
PyObject *__pyx_v_samp = 0;
PyObject *__pyx_v_vals = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("frample2file (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gen,&__pyx_n_s_samp,&__pyx_n_s_vals,0};
PyObject* values[3] = {0,0,0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_gen)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4487, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_samp)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4487, __pyx_L3_error)
else {
__Pyx_RaiseArgtupleInvalid("frample2file", 1, 3, 3, 1); __PYX_ERR(0, 4487, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 2:
if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_vals)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[2]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4487, __pyx_L3_error)
else {
__Pyx_RaiseArgtupleInvalid("frample2file", 1, 3, 3, 2); __PYX_ERR(0, 4487, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "frample2file") < 0)) __PYX_ERR(0, 4487, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 3)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
}
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)values[0]);
__pyx_v_samp = ((PyObject*)values[1]);
__pyx_v_vals = values[2];
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("frample2file", 1, 3, 3, __pyx_nargs); __PYX_ERR(0, 4487, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.frample2file", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gen), __pyx_ptype_8pysndlib_3clm_mus_any, 0, "gen", 0))) __PYX_ERR(0, 4487, __pyx_L1_error)
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_samp), (&PyInt_Type), 0, "samp", 1))) __PYX_ERR(0, 4487, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_474frample2file(__pyx_self, __pyx_v_gen, __pyx_v_samp, __pyx_v_vals);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_474frample2file(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, PyObject *__pyx_v_samp, PyObject *__pyx_v_vals) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8pysndlib_3clm_frample2file(__pyx_v_gen, __pyx_v_samp, __pyx_v_vals, 0); if (unlikely(__pyx_t_1 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 4487, __pyx_L1_error)
__pyx_t_2 = PyFloat_FromDouble(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4487, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("pysndlib.clm.frample2file", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_tuple__532 = PyTuple_Pack(3, __pyx_n_s_gen, __pyx_n_s_samp, __pyx_n_s_vals); if (unlikely(!__pyx_tuple__532)) __PYX_ERR(0, 4487, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__532);
__Pyx_GIVEREF(__pyx_tuple__532);
/* … */
__pyx_t_43 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 4487, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
if (PyDict_SetItem(__pyx_t_43, __pyx_n_s_gen, __pyx_n_s_mus_any) < 0) __PYX_ERR(0, 4487, __pyx_L1_error)
if (PyDict_SetItem(__pyx_t_43, __pyx_n_s_samp, __pyx_n_s_int_2) < 0) __PYX_ERR(0, 4487, __pyx_L1_error)
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_475frample2file, 0, __pyx_n_s_frample2file, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__533)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 4487, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
__Pyx_CyFunction_SetAnnotationsDict(__pyx_t_40, __pyx_t_43);
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
if (PyDict_SetItem(__pyx_d, __pyx_n_s_frample2file, __pyx_t_40) < 0) __PYX_ERR(0, 4487, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
__pyx_codeobj__533 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__532, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_frample2file, 4487, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__533)) __PYX_ERR(0, 4487, __pyx_L1_error)
4488: """
4489: add frample 'val' to the output stream handled by the output generator 'obj' at frample 'samp'.
4490:
4491: :param gen: frample2file gem
4492: :param samp: location \in file to write
4493: :param vals: sample value to write. list or np.ndarray
4494: :rtype: float
4495: """
+4496: cdef double [:] val_view = None
__pyx_t_1 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(Py_None, PyBUF_WRITABLE); if (unlikely(!__pyx_t_1.memview)) __PYX_ERR(0, 4496, __pyx_L1_error) __pyx_v_val_view = __pyx_t_1; __pyx_t_1.memview = NULL; __pyx_t_1.data = NULL;
4497:
+4498: if isinstance(vals, list):
__pyx_t_2 = PyList_Check(__pyx_v_vals);
if (__pyx_t_2) {
/* … */
}
+4499: vals = np.array(vals)
__Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4499, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_array); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4499, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = NULL; __pyx_t_6 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_5))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_5, function); __pyx_t_6 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v_vals}; __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4499, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } __Pyx_DECREF_SET(__pyx_v_vals, __pyx_t_3); __pyx_t_3 = 0;
4500:
+4501: val_view = vals
__pyx_t_1 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_v_vals, PyBUF_WRITABLE); if (unlikely(!__pyx_t_1.memview)) __PYX_ERR(0, 4501, __pyx_L1_error) __PYX_XCLEAR_MEMVIEW(&__pyx_v_val_view, 1); __pyx_v_val_view = __pyx_t_1; __pyx_t_1.memview = NULL; __pyx_t_1.data = NULL;
4502:
+4503: frample = val_view
__PYX_INC_MEMVIEW(&__pyx_v_val_view, 1); __pyx_v_frample = __pyx_v_val_view;
+4504: cclm.mus_frample_to_file(gen._ptr, samp, &frample[0])
__pyx_t_7 = __Pyx_PyInt_As_int64_t(__pyx_v_samp); if (unlikely((__pyx_t_7 == ((mus_long_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 4504, __pyx_L1_error) __pyx_t_8 = 0; __pyx_t_6 = -1; if (__pyx_t_8 < 0) { __pyx_t_8 += __pyx_v_frample.shape[0]; if (unlikely(__pyx_t_8 < 0)) __pyx_t_6 = 0; } else if (unlikely(__pyx_t_8 >= __pyx_v_frample.shape[0])) __pyx_t_6 = 0; if (unlikely(__pyx_t_6 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_6); __PYX_ERR(0, 4504, __pyx_L1_error) } (void)(mus_frample_to_file(__pyx_v_gen->_ptr, __pyx_t_7, (&(*((double *) ( /* dim=0 */ (__pyx_v_frample.data + __pyx_t_8 * __pyx_v_frample.strides[0]) ))))));
+4505: return vals
__pyx_t_9 = __pyx_PyFloat_AsDouble(__pyx_v_vals); if (unlikely((__pyx_t_9 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 4505, __pyx_L1_error) __pyx_r = __pyx_t_9; goto __pyx_L0;
4506:
+4507: cpdef bint is_frample2file(gen: mus_any):
static PyObject *__pyx_pw_8pysndlib_3clm_477is_frample2file(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static int __pyx_f_8pysndlib_3clm_is_frample2file(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, CYTHON_UNUSED int __pyx_skip_dispatch) {
int __pyx_r;
/* … */
/* function exit code */
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_477is_frample2file(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_476is_frample2file, "\n returns True if gen is a frample2file.\n \n :param gen: gen\n :rtype: bool\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_477is_frample2file = {"is_frample2file", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_477is_frample2file, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_476is_frample2file};
static PyObject *__pyx_pw_8pysndlib_3clm_477is_frample2file(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("is_frample2file (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gen,0};
PyObject* values[1] = {0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_gen)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4507, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "is_frample2file") < 0)) __PYX_ERR(0, 4507, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 1)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
}
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)values[0]);
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("is_frample2file", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 4507, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.is_frample2file", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gen), __pyx_ptype_8pysndlib_3clm_mus_any, 0, "gen", 0))) __PYX_ERR(0, 4507, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_476is_frample2file(__pyx_self, __pyx_v_gen);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_476is_frample2file(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8pysndlib_3clm_is_frample2file(__pyx_v_gen, 0); if (unlikely(__pyx_t_1 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 4507, __pyx_L1_error)
__pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4507, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("pysndlib.clm.is_frample2file", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_40 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 4507, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
if (PyDict_SetItem(__pyx_t_40, __pyx_n_s_gen, __pyx_n_s_mus_any) < 0) __PYX_ERR(0, 4507, __pyx_L1_error)
__pyx_t_43 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_477is_frample2file, 0, __pyx_n_s_is_frample2file, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__534)); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 4507, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
__Pyx_CyFunction_SetAnnotationsDict(__pyx_t_43, __pyx_t_40);
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
if (PyDict_SetItem(__pyx_d, __pyx_n_s_is_frample2file, __pyx_t_43) < 0) __PYX_ERR(0, 4507, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
/* … */
__pyx_codeobj__534 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__56, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_is_frample2file, 4507, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__534)) __PYX_ERR(0, 4507, __pyx_L1_error)
4508: """
4509: returns True if gen is a frample2file.
4510:
4511: :param gen: gen
4512: :rtype: bool
4513: """
+4514: return cclm.mus_is_frample_to_file(gen._ptr)
__pyx_r = mus_is_frample_to_file(__pyx_v_gen->_ptr); goto __pyx_L0;
4515:
4516:
+4517: cpdef mus_any continue_frample2file(name: str):
static PyObject *__pyx_pw_8pysndlib_3clm_479continue_frample2file(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_f_8pysndlib_3clm_continue_frample2file(PyObject *__pyx_v_name, CYTHON_UNUSED int __pyx_skip_dispatch) {
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_r = NULL;
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("pysndlib.clm.continue_frample2file", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XGIVEREF((PyObject *)__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_479continue_frample2file(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_478continue_frample2file, "\n reopen an existing file to continue adding sound data to it.\n \n :param filename: name of file to write\n :return: frample2file gen\n :rtype: mus_any\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_479continue_frample2file = {"continue_frample2file", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_479continue_frample2file, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_478continue_frample2file};
static PyObject *__pyx_pw_8pysndlib_3clm_479continue_frample2file(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
PyObject *__pyx_v_name = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("continue_frample2file (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_name,0};
PyObject* values[1] = {0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_name)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4517, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "continue_frample2file") < 0)) __PYX_ERR(0, 4517, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 1)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
}
__pyx_v_name = ((PyObject*)values[0]);
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("continue_frample2file", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 4517, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.continue_frample2file", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_name), (&PyString_Type), 0, "name", 1))) __PYX_ERR(0, 4517, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_478continue_frample2file(__pyx_self, __pyx_v_name);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_478continue_frample2file(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_name) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = ((PyObject *)__pyx_f_8pysndlib_3clm_continue_frample2file(__pyx_v_name, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4517, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("pysndlib.clm.continue_frample2file", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_43 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 4517, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
if (PyDict_SetItem(__pyx_t_43, __pyx_n_s_name, __pyx_n_s_str_2) < 0) __PYX_ERR(0, 4517, __pyx_L1_error)
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_479continue_frample2file, 0, __pyx_n_s_continue_frample2file, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__535)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 4517, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
__Pyx_CyFunction_SetAnnotationsDict(__pyx_t_40, __pyx_t_43);
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
if (PyDict_SetItem(__pyx_d, __pyx_n_s_continue_frample2file, __pyx_t_40) < 0) __PYX_ERR(0, 4517, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
/* … */
__pyx_codeobj__535 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__525, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_continue_frample2file, 4517, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__535)) __PYX_ERR(0, 4517, __pyx_L1_error)
4518: """
4519: reopen an existing file to continue adding sound data to it.
4520:
4521: :param filename: name of file to write
4522: :return: frample2file gen
4523: :rtype: mus_any
4524: """
+4525: return mus_any.from_ptr(cclm.mus_continue_frample_to_file(name))
__Pyx_XDECREF((PyObject *)__pyx_r); __pyx_t_1 = __Pyx_PyObject_AsString(__pyx_v_name); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) __PYX_ERR(0, 4525, __pyx_L1_error) __pyx_t_2 = ((PyObject *)__pyx_vtabptr_8pysndlib_3clm_mus_any->from_ptr(mus_continue_frample_to_file(__pyx_t_1), NULL)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4525, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_r = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_t_2); __pyx_t_2 = 0; goto __pyx_L0;
4526:
4527:
4528: # ---------------- readin ---------------- #
+4529: cpdef mus_any make_readin(filename: str, chan: int=0, start: int=0, direction: Optional[int]=1, buffer_size: Optional[int]=None):
static PyObject *__pyx_pw_8pysndlib_3clm_481make_readin(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_f_8pysndlib_3clm_make_readin(PyObject *__pyx_v_filename, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_8pysndlib_3clm_make_readin *__pyx_optional_args) {
PyObject *__pyx_v_chan = __pyx_k__50;
PyObject *__pyx_v_start = __pyx_k__51;
PyObject *__pyx_v_direction = ((PyObject *)__pyx_int_1);
PyObject *__pyx_v_buffer_size = ((PyObject *)Py_None);
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_r = NULL;
if (__pyx_optional_args) {
if (__pyx_optional_args->__pyx_n > 0) {
__pyx_v_chan = __pyx_optional_args->chan;
if (__pyx_optional_args->__pyx_n > 1) {
__pyx_v_start = __pyx_optional_args->start;
if (__pyx_optional_args->__pyx_n > 2) {
__pyx_v_direction = __pyx_optional_args->direction;
if (__pyx_optional_args->__pyx_n > 3) {
__pyx_v_buffer_size = __pyx_optional_args->buffer_size;
}
}
}
}
}
__Pyx_INCREF(__pyx_v_buffer_size);
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_AddTraceback("pysndlib.clm.make_readin", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XDECREF(__pyx_v_buffer_size);
__Pyx_XGIVEREF((PyObject *)__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_481make_readin(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_480make_readin, "\n return a new readin (file input) generator reading the sound file 'file' starting at frample\n 'start' \\in channel 'channel' and reading forward if 'direction' is not -1.\n \n :param filename: name of file to read\n :param chan: channel to read (0 based)\n :param start: location \\in samples to start at\n :param direction: forward (1) or backward (-1)\n :param buffer_size: io buffer size\n \n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_481make_readin = {"make_readin", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_481make_readin, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_480make_readin};
static PyObject *__pyx_pw_8pysndlib_3clm_481make_readin(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
PyObject *__pyx_v_filename = 0;
PyObject *__pyx_v_chan = 0;
PyObject *__pyx_v_start = 0;
PyObject *__pyx_v_direction = 0;
PyObject *__pyx_v_buffer_size = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("make_readin (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_filename,&__pyx_n_s_chan,&__pyx_n_s_start,&__pyx_n_s_direction,&__pyx_n_s_buffer_size,0};
PyObject* values[5] = {0,0,0,0,0};
values[1] = __Pyx_Arg_NewRef_FASTCALL(__pyx_k__50);
values[2] = __Pyx_Arg_NewRef_FASTCALL(__pyx_k__51);
values[3] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)__pyx_int_1));
values[4] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4);
CYTHON_FALLTHROUGH;
case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
CYTHON_FALLTHROUGH;
case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_filename)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4529, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_chan);
if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4529, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 2:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_start);
if (value) { values[2] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4529, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 3:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_direction);
if (value) { values[3] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4529, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 4:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_buffer_size);
if (value) { values[4] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4529, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "make_readin") < 0)) __PYX_ERR(0, 4529, __pyx_L3_error)
}
} else {
switch (__pyx_nargs) {
case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4);
CYTHON_FALLTHROUGH;
case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
CYTHON_FALLTHROUGH;
case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
break;
default: goto __pyx_L5_argtuple_error;
}
}
__pyx_v_filename = ((PyObject*)values[0]);
__pyx_v_chan = ((PyObject*)values[1]);
__pyx_v_start = ((PyObject*)values[2]);
__pyx_v_direction = values[3];
__pyx_v_buffer_size = values[4];
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("make_readin", 0, 1, 5, __pyx_nargs); __PYX_ERR(0, 4529, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.make_readin", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_filename), (&PyString_Type), 0, "filename", 1))) __PYX_ERR(0, 4529, __pyx_L1_error)
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_chan), (&PyInt_Type), 0, "chan", 1))) __PYX_ERR(0, 4529, __pyx_L1_error)
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_start), (&PyInt_Type), 0, "start", 1))) __PYX_ERR(0, 4529, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_480make_readin(__pyx_self, __pyx_v_filename, __pyx_v_chan, __pyx_v_start, __pyx_v_direction, __pyx_v_buffer_size);
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_480make_readin(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_filename, PyObject *__pyx_v_chan, PyObject *__pyx_v_start, PyObject *__pyx_v_direction, PyObject *__pyx_v_buffer_size) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_2.__pyx_n = 4;
__pyx_t_2.chan = __pyx_v_chan;
__pyx_t_2.start = __pyx_v_start;
__pyx_t_2.direction = __pyx_v_direction;
__pyx_t_2.buffer_size = __pyx_v_buffer_size;
__pyx_t_1 = ((PyObject *)__pyx_f_8pysndlib_3clm_make_readin(__pyx_v_filename, 0, &__pyx_t_2)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4529, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("pysndlib.clm.make_readin", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
if (!(likely(__Pyx_Py3Int_CheckExact(__pyx_int_0)) || __Pyx_RaiseUnexpectedTypeError("int", __pyx_int_0))) __PYX_ERR(0, 4529, __pyx_L1_error)
__Pyx_INCREF(__pyx_int_0);
__pyx_k__50 = ((PyObject*)__pyx_int_0);
__Pyx_GIVEREF(__pyx_int_0);
if (!(likely(__Pyx_Py3Int_CheckExact(__pyx_int_0)) || __Pyx_RaiseUnexpectedTypeError("int", __pyx_int_0))) __PYX_ERR(0, 4529, __pyx_L1_error)
__Pyx_INCREF(__pyx_int_0);
__pyx_k__51 = ((PyObject*)__pyx_int_0);
__Pyx_GIVEREF(__pyx_int_0);
/* … */
__pyx_tuple__536 = PyTuple_Pack(5, __pyx_n_s_filename, __pyx_n_s_chan, __pyx_n_s_start, __pyx_n_s_direction, __pyx_n_s_buffer_size); if (unlikely(!__pyx_tuple__536)) __PYX_ERR(0, 4529, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__536);
__Pyx_GIVEREF(__pyx_tuple__536);
if (!(likely(__Pyx_Py3Int_CheckExact(__pyx_int_0)) || __Pyx_RaiseUnexpectedTypeError("int", __pyx_int_0))) __PYX_ERR(0, 4529, __pyx_L1_error)
if (!(likely(__Pyx_Py3Int_CheckExact(__pyx_int_0)) || __Pyx_RaiseUnexpectedTypeError("int", __pyx_int_0))) __PYX_ERR(0, 4529, __pyx_L1_error)
__pyx_t_40 = PyTuple_New(4); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 4529, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
__Pyx_INCREF(__pyx_int_0);
__Pyx_GIVEREF(__pyx_int_0);
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_40, 0, __pyx_int_0)) __PYX_ERR(0, 4529, __pyx_L1_error);
__Pyx_INCREF(__pyx_int_0);
__Pyx_GIVEREF(__pyx_int_0);
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_40, 1, __pyx_int_0)) __PYX_ERR(0, 4529, __pyx_L1_error);
__Pyx_INCREF(__pyx_int_1);
__Pyx_GIVEREF(__pyx_int_1);
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_40, 2, __pyx_int_1)) __PYX_ERR(0, 4529, __pyx_L1_error);
__Pyx_INCREF(Py_None);
__Pyx_GIVEREF(Py_None);
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_40, 3, Py_None)) __PYX_ERR(0, 4529, __pyx_L1_error);
__pyx_t_43 = __Pyx_PyDict_NewPresized(5); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 4529, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
if (PyDict_SetItem(__pyx_t_43, __pyx_n_s_filename, __pyx_n_s_str_2) < 0) __PYX_ERR(0, 4529, __pyx_L1_error)
if (PyDict_SetItem(__pyx_t_43, __pyx_n_s_chan, __pyx_n_s_int_2) < 0) __PYX_ERR(0, 4529, __pyx_L1_error)
if (PyDict_SetItem(__pyx_t_43, __pyx_n_s_start, __pyx_n_s_int_2) < 0) __PYX_ERR(0, 4529, __pyx_L1_error)
if (PyDict_SetItem(__pyx_t_43, __pyx_n_s_direction, __pyx_kp_s_Optional_int) < 0) __PYX_ERR(0, 4529, __pyx_L1_error)
if (PyDict_SetItem(__pyx_t_43, __pyx_n_s_buffer_size, __pyx_kp_s_Optional_int) < 0) __PYX_ERR(0, 4529, __pyx_L1_error)
__pyx_t_37 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_481make_readin, 0, __pyx_n_s_make_readin, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__537)); if (unlikely(!__pyx_t_37)) __PYX_ERR(0, 4529, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_37);
__Pyx_CyFunction_SetDefaultsTuple(__pyx_t_37, __pyx_t_40);
__Pyx_CyFunction_SetAnnotationsDict(__pyx_t_37, __pyx_t_43);
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
if (PyDict_SetItem(__pyx_d, __pyx_n_s_make_readin, __pyx_t_37) < 0) __PYX_ERR(0, 4529, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_37); __pyx_t_37 = 0;
__pyx_codeobj__537 = (PyObject*)__Pyx_PyCode_New(5, 0, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__536, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_make_readin, 4529, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__537)) __PYX_ERR(0, 4529, __pyx_L1_error)
/* … */
struct __pyx_opt_args_8pysndlib_3clm_make_readin {
int __pyx_n;
PyObject *chan;
PyObject *start;
PyObject *direction;
PyObject *buffer_size;
};
4530: """
4531: return a new readin (file input) generator reading the sound file 'file' starting at frample
4532: 'start' \in channel 'channel' and reading forward if 'direction' is not -1.
4533:
4534: :param filename: name of file to read
4535: :param chan: channel to read (0 based)
4536: :param start: location \in samples to start at
4537: :param direction: forward (1) or backward (-1)
4538: :param buffer_size: io buffer size
4539:
4540: """
+4541: check_range('chan', chan, 0, None)
__pyx_t_2.__pyx_n = 2; __pyx_t_2.low = __pyx_int_0; __pyx_t_2.high = Py_None; __pyx_t_1 = __pyx_f_8pysndlib_3clm_check_range(__pyx_n_s_chan, __pyx_v_chan, 0, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4541, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+4542: check_range('start', start, 0, None)
__pyx_t_2.__pyx_n = 2; __pyx_t_2.low = __pyx_int_0; __pyx_t_2.high = Py_None; __pyx_t_1 = __pyx_f_8pysndlib_3clm_check_range(__pyx_n_s_start, __pyx_v_start, 0, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4542, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+4543: check_range('buffer_size', buffer_size, 0, None)
__pyx_t_2.__pyx_n = 2; __pyx_t_2.low = __pyx_int_0; __pyx_t_2.high = Py_None; __pyx_t_1 = __pyx_f_8pysndlib_3clm_check_range(__pyx_n_s_buffer_size, __pyx_v_buffer_size, 0, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4543, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4544:
+4545: if not os.path.isfile(filename):
__Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_os); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4545, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_path); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4545, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_isfile); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4545, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = NULL; __pyx_t_5 = 0; #if CYTHON_UNPACK_METHODS if (likely(PyMethod_Check(__pyx_t_3))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); __pyx_t_5 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v_filename}; __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4545, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 4545, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_7 = (!__pyx_t_6); if (unlikely(__pyx_t_7)) { /* … */ }
+4546: raise FileNotFoundError(f'readin: {filename} does not exist.')
__Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_FileNotFoundError); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4546, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4546, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_8 = 0; __pyx_t_9 = 127; __Pyx_INCREF(__pyx_kp_u_readin); __pyx_t_8 += 8; __Pyx_GIVEREF(__pyx_kp_u_readin); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_kp_u_readin); __pyx_t_4 = __Pyx_PyObject_FormatSimple(__pyx_v_filename, __pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4546, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_9 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) > __pyx_t_9) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) : __pyx_t_9; __pyx_t_8 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_4); __pyx_t_4 = 0; __Pyx_INCREF(__pyx_kp_u_does_not_exist); __pyx_t_8 += 16; __Pyx_GIVEREF(__pyx_kp_u_does_not_exist); PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_kp_u_does_not_exist); __pyx_t_4 = __Pyx_PyUnicode_Join(__pyx_t_3, 3, __pyx_t_8, __pyx_t_9); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4546, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4546, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __PYX_ERR(0, 4546, __pyx_L1_error)
4547:
+4548: buffer_size = buffer_size or CLM.buffer_size
__pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_v_buffer_size); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(0, 4548, __pyx_L1_error) if (!__pyx_t_7) { } else { __Pyx_INCREF(__pyx_v_buffer_size); __pyx_t_3 = __pyx_v_buffer_size; goto __pyx_L4_bool_binop_done; } __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_CLM); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4548, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_buffer_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4548, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = __pyx_t_1; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_L4_bool_binop_done:; __Pyx_DECREF_SET(__pyx_v_buffer_size, __pyx_t_3); __pyx_t_3 = 0;
+4549: return mus_any.from_ptr(cclm.mus_make_readin_with_buffer_size(filename, chan, start, direction, buffer_size))
__Pyx_XDECREF((PyObject *)__pyx_r); __pyx_t_10 = __Pyx_PyObject_AsString(__pyx_v_filename); if (unlikely((!__pyx_t_10) && PyErr_Occurred())) __PYX_ERR(0, 4549, __pyx_L1_error) __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_v_chan); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 4549, __pyx_L1_error) __pyx_t_11 = __Pyx_PyInt_As_int64_t(__pyx_v_start); if (unlikely((__pyx_t_11 == ((mus_long_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 4549, __pyx_L1_error) __pyx_t_12 = __Pyx_PyInt_As_int(__pyx_v_direction); if (unlikely((__pyx_t_12 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 4549, __pyx_L1_error) __pyx_t_13 = __Pyx_PyInt_As_int64_t(__pyx_v_buffer_size); if (unlikely((__pyx_t_13 == ((mus_long_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 4549, __pyx_L1_error) __pyx_t_3 = ((PyObject *)__pyx_vtabptr_8pysndlib_3clm_mus_any->from_ptr(mus_make_readin_with_buffer_size(__pyx_t_10, __pyx_t_5, __pyx_t_11, __pyx_t_12, __pyx_t_13), NULL)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4549, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_r = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_t_3); __pyx_t_3 = 0; goto __pyx_L0;
4550:
+4551: cpdef cython.double readin(gen: mus_any):
static PyObject *__pyx_pw_8pysndlib_3clm_483readin(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static double __pyx_f_8pysndlib_3clm_readin(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, CYTHON_UNUSED int __pyx_skip_dispatch) {
double __pyx_r;
/* … */
/* function exit code */
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_483readin(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_482readin, "\n next sample from readin generator (a sound file reader).\n \n :param gen: readin gen\n :rtype: float\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_483readin = {"readin", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_483readin, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_482readin};
static PyObject *__pyx_pw_8pysndlib_3clm_483readin(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("readin (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gen,0};
PyObject* values[1] = {0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_gen)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4551, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "readin") < 0)) __PYX_ERR(0, 4551, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 1)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
}
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)values[0]);
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("readin", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 4551, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.readin", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gen), __pyx_ptype_8pysndlib_3clm_mus_any, 0, "gen", 0))) __PYX_ERR(0, 4551, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_482readin(__pyx_self, __pyx_v_gen);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_482readin(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8pysndlib_3clm_readin(__pyx_v_gen, 0); if (unlikely(__pyx_t_1 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 4551, __pyx_L1_error)
__pyx_t_2 = PyFloat_FromDouble(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4551, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("pysndlib.clm.readin", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_37 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_37)) __PYX_ERR(0, 4551, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_37);
if (PyDict_SetItem(__pyx_t_37, __pyx_n_s_gen, __pyx_n_s_mus_any) < 0) __PYX_ERR(0, 4551, __pyx_L1_error)
__pyx_t_43 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_483readin, 0, __pyx_n_s_readin_2, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__538)); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 4551, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
__Pyx_CyFunction_SetAnnotationsDict(__pyx_t_43, __pyx_t_37);
__Pyx_DECREF(__pyx_t_37); __pyx_t_37 = 0;
if (PyDict_SetItem(__pyx_d, __pyx_n_s_readin_2, __pyx_t_43) < 0) __PYX_ERR(0, 4551, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
/* … */
__pyx_codeobj__538 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__56, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_readin_2, 4551, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__538)) __PYX_ERR(0, 4551, __pyx_L1_error)
4552: """
4553: next sample from readin generator (a sound file reader).
4554:
4555: :param gen: readin gen
4556: :rtype: float
4557: """
+4558: return cclm.mus_readin(gen._ptr)
__pyx_r = mus_readin(__pyx_v_gen->_ptr); goto __pyx_L0;
4559:
+4560: cpdef is_readin(gen: mus_any):
static PyObject *__pyx_pw_8pysndlib_3clm_485is_readin(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyObject *__pyx_f_8pysndlib_3clm_is_readin(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, CYTHON_UNUSED int __pyx_skip_dispatch) {
PyObject *__pyx_r = NULL;
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("pysndlib.clm.is_readin", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_485is_readin(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_484is_readin, "\n returns True if gen is a readin.\n \n :param gen: gen\n :rtype: bool\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_485is_readin = {"is_readin", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_485is_readin, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_484is_readin};
static PyObject *__pyx_pw_8pysndlib_3clm_485is_readin(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("is_readin (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gen,0};
PyObject* values[1] = {0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_gen)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4560, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "is_readin") < 0)) __PYX_ERR(0, 4560, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 1)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
}
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)values[0]);
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("is_readin", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 4560, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.is_readin", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gen), __pyx_ptype_8pysndlib_3clm_mus_any, 0, "gen", 0))) __PYX_ERR(0, 4560, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_484is_readin(__pyx_self, __pyx_v_gen);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_484is_readin(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8pysndlib_3clm_is_readin(__pyx_v_gen, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4560, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("pysndlib.clm.is_readin", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_43 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 4560, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
if (PyDict_SetItem(__pyx_t_43, __pyx_n_s_gen, __pyx_n_s_mus_any) < 0) __PYX_ERR(0, 4560, __pyx_L1_error)
__pyx_t_37 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_485is_readin, 0, __pyx_n_s_is_readin, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__539)); if (unlikely(!__pyx_t_37)) __PYX_ERR(0, 4560, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_37);
__Pyx_CyFunction_SetAnnotationsDict(__pyx_t_37, __pyx_t_43);
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
if (PyDict_SetItem(__pyx_d, __pyx_n_s_is_readin, __pyx_t_37) < 0) __PYX_ERR(0, 4560, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_37); __pyx_t_37 = 0;
/* … */
__pyx_codeobj__539 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__56, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_is_readin, 4560, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__539)) __PYX_ERR(0, 4560, __pyx_L1_error)
4561: """
4562: returns True if gen is a readin.
4563:
4564: :param gen: gen
4565: :rtype: bool
4566: """
+4567: return cclm.mus_is_readin(gen._ptr)
__Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyBool_FromLong(mus_is_readin(__pyx_v_gen->_ptr)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4567, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
4568:
4569:
4570: # ---------------- src ---------------- #
+4571: def make_src(inp , srate: Optional[float]=1.0, width: Optional[int]=10):
/* Python wrapper */ static PyObject *__pyx_pw_8pysndlib_3clm_487make_src(PyObject *__pyx_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_486make_src, "\n return a new sampling-rate conversion generator (using 'warped sinc interpolation'). 'srate' is the\n ratio between the new rate and the old. 'width' is the sine width (effectively the steepness of the\n low-pass filter), normally between 10 and 100. 'input' if given is an open file stream.\n \n :param inp: gen or function to read from. if a callback, the function takes 1 input, the direction and should return read value\n :param srate: ratio between the old sampling rate and the new\n :param width: how many samples to convolve with sinc function\n :return: src gen\n :rtype: mus_any\n "); static PyMethodDef __pyx_mdef_8pysndlib_3clm_487make_src = {"make_src", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_487make_src, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_486make_src}; static PyObject *__pyx_pw_8pysndlib_3clm_487make_src(PyObject *__pyx_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { PyObject *__pyx_v_inp = 0; PyObject *__pyx_v_srate = 0; PyObject *__pyx_v_width = 0; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("make_src (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_MACROS __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { PyObject **__pyx_pyargnames[] = {&__pyx_n_s_inp,&__pyx_n_s_srate,&__pyx_n_s_width,0}; PyObject* values[3] = {0,0,0}; values[1] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)((PyObject*)__pyx_float_1_0))); values[2] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)((PyObject *)__pyx_int_10))); if (__pyx_kwds) { Py_ssize_t kw_args; switch (__pyx_nargs) { case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); CYTHON_FALLTHROUGH; case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); CYTHON_FALLTHROUGH; case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); switch (__pyx_nargs) { case 0: if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_inp)) != 0)) { (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); kw_args--; } else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4571, __pyx_L3_error) else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: if (kw_args > 0) { PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_srate); if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4571, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: if (kw_args > 0) { PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_width); if (value) { values[2] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4571, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { const Py_ssize_t kwd_pos_args = __pyx_nargs; if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "make_src") < 0)) __PYX_ERR(0, 4571, __pyx_L3_error) } } else { switch (__pyx_nargs) { case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); CYTHON_FALLTHROUGH; case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); CYTHON_FALLTHROUGH; case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); break; default: goto __pyx_L5_argtuple_error; } } __pyx_v_inp = values[0]; __pyx_v_srate = values[1]; __pyx_v_width = values[2]; } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("make_src", 0, 1, 3, __pyx_nargs); __PYX_ERR(0, 4571, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; { Py_ssize_t __pyx_temp; for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); } } __Pyx_AddTraceback("pysndlib.clm.make_src", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_8pysndlib_3clm_486make_src(__pyx_self, __pyx_v_inp, __pyx_v_srate, __pyx_v_width); int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; /* function exit code */ { Py_ssize_t __pyx_temp; for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); } } __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ static PyObject *__pyx_pf_8pysndlib_3clm_486make_src(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_inp, PyObject *__pyx_v_srate, PyObject *__pyx_v_width) { struct __pyx_obj_8pysndlib_3clm___pyx_scope_struct_1_make_src *__pyx_cur_scope; input_cb __pyx_v_cy_inp_f_ptr; struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_res = NULL; PyObject *__pyx_v_inp_f = 0; PyObject *__pyx_r = NULL; __pyx_cur_scope = (struct __pyx_obj_8pysndlib_3clm___pyx_scope_struct_1_make_src *)__pyx_tp_new_8pysndlib_3clm___pyx_scope_struct_1_make_src(__pyx_ptype_8pysndlib_3clm___pyx_scope_struct_1_make_src, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_cur_scope)) { __pyx_cur_scope = ((struct __pyx_obj_8pysndlib_3clm___pyx_scope_struct_1_make_src *)Py_None); __Pyx_INCREF(Py_None); __PYX_ERR(0, 4571, __pyx_L1_error) } else { __Pyx_GOTREF((PyObject *)__pyx_cur_scope); } __pyx_cur_scope->__pyx_v_inp = __pyx_v_inp; __Pyx_INCREF(__pyx_cur_scope->__pyx_v_inp); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_inp); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_7); __Pyx_XDECREF(__pyx_t_8); __Pyx_XDECREF(__pyx_t_9); __Pyx_AddTraceback("pysndlib.clm.make_src", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_res); __Pyx_XDECREF(__pyx_v_inp_f); __Pyx_DECREF((PyObject *)__pyx_cur_scope); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__540 = PyTuple_Pack(7, __pyx_n_s_inp, __pyx_n_s_srate, __pyx_n_s_width, __pyx_n_s_cy_inp_f_ptr, __pyx_n_s_res, __pyx_n_s_inp_f, __pyx_n_s_inp_f); if (unlikely(!__pyx_tuple__540)) __PYX_ERR(0, 4571, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__540); __Pyx_GIVEREF(__pyx_tuple__540); __pyx_codeobj__541 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 7, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__540, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_make_src, 4571, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__541)) __PYX_ERR(0, 4571, __pyx_L1_error) /* … */ __pyx_t_37 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_37)) __PYX_ERR(0, 4571, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_37); if (PyDict_SetItem(__pyx_t_37, __pyx_n_s_srate, __pyx_kp_s_Optional_float) < 0) __PYX_ERR(0, 4571, __pyx_L1_error) if (PyDict_SetItem(__pyx_t_37, __pyx_n_s_width, __pyx_kp_s_Optional_int) < 0) __PYX_ERR(0, 4571, __pyx_L1_error) __pyx_t_43 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_487make_src, 0, __pyx_n_s_make_src, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__541)); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 4571, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_43); __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_43, __pyx_tuple__542); __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_43, __pyx_t_37); __Pyx_DECREF(__pyx_t_37); __pyx_t_37 = 0; if (PyDict_SetItem(__pyx_d, __pyx_n_s_make_src, __pyx_t_43) < 0) __PYX_ERR(0, 4571, __pyx_L1_error) __Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0; __pyx_tuple__542 = PyTuple_Pack(2, ((PyObject*)__pyx_float_1_0), ((PyObject *)__pyx_int_10)); if (unlikely(!__pyx_tuple__542)) __PYX_ERR(0, 4571, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__542); __Pyx_GIVEREF(__pyx_tuple__542); /* … */ struct __pyx_obj_8pysndlib_3clm___pyx_scope_struct_1_make_src { PyObject_HEAD PyObject *__pyx_v_inp; };
4572: """
4573: return a new sampling-rate conversion generator (using 'warped sinc interpolation'). 'srate' is the
4574: ratio between the new rate and the old. 'width' is the sine width (effectively the steepness of the
4575: low-pass filter), normally between 10 and 100. 'input' if given is an open file stream.
4576:
4577: :param inp: gen or function to read from. if a callback, the function takes 1 input, the direction and should return read value
4578: :param srate: ratio between the old sampling rate and the new
4579: :param width: how many samples to convolve with sinc function
4580: :return: src gen
4581: :rtype: mus_any
4582: """
4583:
+4584: check_range('srate', srate, 0, None)
__pyx_t_2.__pyx_n = 2; __pyx_t_2.low = __pyx_int_0; __pyx_t_2.high = Py_None; __pyx_t_1 = __pyx_f_8pysndlib_3clm_check_range(__pyx_n_s_srate, __pyx_v_srate, 0, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4584, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+4585: check_range('width', width, 0, None)
__pyx_t_2.__pyx_n = 2; __pyx_t_2.low = __pyx_int_0; __pyx_t_2.high = Py_None; __pyx_t_1 = __pyx_f_8pysndlib_3clm_check_range(__pyx_n_s_width, __pyx_v_width, 0, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4585, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4586:
4587: cdef cclm.input_cb cy_inp_f_ptr
4588:
+4589: if(isinstance(inp, mus_any)):
__pyx_t_1 = __pyx_cur_scope->__pyx_v_inp; __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = __Pyx_TypeCheck(__pyx_t_1, __pyx_ptype_8pysndlib_3clm_mus_any); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_3) { /* … */ }
+4590: res = mus_any.from_ptr(cclm.mus_make_src(<cclm.input_cb>input_callback_func, srate, width, <void*>((<mus_any>inp)._ptr)))
__pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_v_srate); if (unlikely((__pyx_t_4 == ((mus_float_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 4590, __pyx_L1_error) __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_v_width); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 4590, __pyx_L1_error) __pyx_t_1 = ((PyObject *)__pyx_vtabptr_8pysndlib_3clm_mus_any->from_ptr(mus_make_src(((input_cb)__pyx_f_8pysndlib_3clm_input_callback_func), __pyx_t_4, __pyx_t_5, ((void *)((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_cur_scope->__pyx_v_inp)->_ptr)), NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4590, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_res = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_t_1); __pyx_t_1 = 0;
+4591: res._inputcallback = <cclm.input_cb>input_callback_func
__pyx_v_res->_inputcallback = ((input_cb)__pyx_f_8pysndlib_3clm_input_callback_func);
+4592: return res
__Pyx_XDECREF(__pyx_r); __Pyx_INCREF((PyObject *)__pyx_v_res); __pyx_r = ((PyObject *)__pyx_v_res); goto __pyx_L0;
4593:
4594:
+4595: if not callable(inp):
__pyx_t_1 = __pyx_cur_scope->__pyx_v_inp; __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = __Pyx_PyCallable_Check(__pyx_t_1); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 4595, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_6 = (!__pyx_t_3); if (unlikely(__pyx_t_6)) { /* … */ }
+4596: raise TypeError(f"input needs to be a clm gen or function not a {type(inp)}")
__pyx_t_1 = __Pyx_PyObject_FormatSimple(((PyObject *)Py_TYPE(__pyx_cur_scope->__pyx_v_inp)), __pyx_empty_unicode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4596, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_7 = __Pyx_PyUnicode_Concat(__pyx_kp_u_input_needs_to_be_a_clm_gen_or_f, __pyx_t_1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 4596, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4596, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __PYX_ERR(0, 4596, __pyx_L1_error)
4597:
+4598: @INPUTCALLBACK
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_8make_src_1inp_f(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_8pysndlib_3clm_8make_src_1inp_f = {"inp_f", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_8make_src_1inp_f, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_8pysndlib_3clm_8make_src_1inp_f(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
CYTHON_UNUSED PyObject *__pyx_v_gen = 0;
PyObject *__pyx_v_d = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("inp_f (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gen,&__pyx_n_s_d,0};
PyObject* values[2] = {0,0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_gen)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4598, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_d)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4598, __pyx_L3_error)
else {
__Pyx_RaiseArgtupleInvalid("inp_f", 1, 2, 2, 1); __PYX_ERR(0, 4598, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "inp_f") < 0)) __PYX_ERR(0, 4598, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 2)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
}
__pyx_v_gen = values[0];
__pyx_v_d = values[1];
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("inp_f", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 4598, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.make_src.inp_f", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_8pysndlib_3clm_8make_src_inp_f(__pyx_self, __pyx_v_gen, __pyx_v_d);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_8make_src_inp_f(PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_gen, PyObject *__pyx_v_d) {
struct __pyx_obj_8pysndlib_3clm___pyx_scope_struct_1_make_src *__pyx_cur_scope;
struct __pyx_obj_8pysndlib_3clm___pyx_scope_struct_1_make_src *__pyx_outer_scope;
PyObject *__pyx_r = NULL;
__pyx_outer_scope = (struct __pyx_obj_8pysndlib_3clm___pyx_scope_struct_1_make_src *) __Pyx_CyFunction_GetClosure(__pyx_self);
__pyx_cur_scope = __pyx_outer_scope;
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_AddTraceback("pysndlib.clm.make_src.inp_f", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_INPUTCALLBACK); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 4598, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_7);
/* … */
__pyx_tuple__52 = PyTuple_Pack(2, __pyx_n_s_gen, __pyx_n_s_d); if (unlikely(!__pyx_tuple__52)) __PYX_ERR(0, 4598, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__52);
__Pyx_GIVEREF(__pyx_tuple__52);
__pyx_t_8 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_8make_src_1inp_f, 0, __pyx_n_s_make_src_locals_inp_f, ((PyObject*)__pyx_cur_scope), __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__53)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 4598, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_8);
__pyx_t_9 = NULL;
__pyx_t_5 = 0;
#if CYTHON_UNPACK_METHODS
if (unlikely(PyMethod_Check(__pyx_t_7))) {
__pyx_t_9 = PyMethod_GET_SELF(__pyx_t_7);
if (likely(__pyx_t_9)) {
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
__Pyx_INCREF(__pyx_t_9);
__Pyx_INCREF(function);
__Pyx_DECREF_SET(__pyx_t_7, function);
__pyx_t_5 = 1;
}
}
#endif
{
PyObject *__pyx_callargs[2] = {__pyx_t_9, __pyx_t_8};
__pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_7, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5);
__Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4598, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
}
__pyx_v_inp_f = __pyx_t_1;
__pyx_t_1 = 0;
__pyx_codeobj__53 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__52, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_inp_f, 4598, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__53)) __PYX_ERR(0, 4598, __pyx_L1_error)
4599: def inp_f(gen, d):
+4600: return inp(d)
__Pyx_XDECREF(__pyx_r); if (unlikely(!__pyx_cur_scope->__pyx_v_inp)) { __Pyx_RaiseClosureNameError("inp"); __PYX_ERR(0, 4600, __pyx_L1_error) } __Pyx_INCREF(__pyx_cur_scope->__pyx_v_inp); __pyx_t_2 = __pyx_cur_scope->__pyx_v_inp; __pyx_t_3 = NULL; __pyx_t_4 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_2))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); __pyx_t_4 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v_d}; __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4600, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
4601:
+4602: cy_inp_f_ptr = (<cclm.input_cb*><size_t>ctypes.addressof(inp_f))[0]
__Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_ctypes); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 4602, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_addressof); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 4602, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_7 = NULL; __pyx_t_5 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_8))) { __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_8); if (likely(__pyx_t_7)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8); __Pyx_INCREF(__pyx_t_7); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_8, function); __pyx_t_5 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_v_inp_f}; __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_8, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5); __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4602, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; } __pyx_t_10 = __Pyx_PyInt_As_size_t(__pyx_t_1); if (unlikely((__pyx_t_10 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 4602, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_cy_inp_f_ptr = (((input_cb *)((size_t)__pyx_t_10))[0]);
+4603: res = mus_any.from_ptr(cclm.mus_make_src(cy_inp_f_ptr, srate, width, NULL))
__pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_v_srate); if (unlikely((__pyx_t_4 == ((mus_float_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 4603, __pyx_L1_error) __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_v_width); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 4603, __pyx_L1_error) __pyx_t_1 = ((PyObject *)__pyx_vtabptr_8pysndlib_3clm_mus_any->from_ptr(mus_make_src(__pyx_v_cy_inp_f_ptr, __pyx_t_4, __pyx_t_5, NULL), NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4603, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_res = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_t_1); __pyx_t_1 = 0;
+4604: res._inputcallback = cy_inp_f_ptr
__pyx_v_res->_inputcallback = __pyx_v_cy_inp_f_ptr;
+4605: res.cache_append(inp_f)
__pyx_t_1 = ((struct __pyx_vtabstruct_8pysndlib_3clm_mus_any *)__pyx_v_res->__pyx_vtab)->cache_append(__pyx_v_res, __pyx_v_inp_f, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4605, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4606:
+4607: return res
__Pyx_XDECREF(__pyx_r); __Pyx_INCREF((PyObject *)__pyx_v_res); __pyx_r = ((PyObject *)__pyx_v_res); goto __pyx_L0;
4608:
+4609: cpdef cython.double src(gen: mus_any, sr_change: Optional[float]=0.0):
static PyObject *__pyx_pw_8pysndlib_3clm_489src(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static double __pyx_f_8pysndlib_3clm_src(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_8pysndlib_3clm_src *__pyx_optional_args) {
PyObject *__pyx_v_sr_change = ((PyObject *)__pyx_float_0_0);
double __pyx_r;
if (__pyx_optional_args) {
if (__pyx_optional_args->__pyx_n > 0) {
__pyx_v_sr_change = __pyx_optional_args->sr_change;
}
}
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_AddTraceback("pysndlib.clm.src", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = -1;
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_489src(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_488src, "\n next sampling rate conversion sample. 'pm' can be used to change the sampling rate on a\n sample-by-sample basis. 'input-function' is a function of one argument (the current input direction,\n normally ignored) that is called internally whenever a new sample of input data is needed. if the\n associated make_src included an 'input' argument, input-function is ignored.\n \n :param gen: src gen\n :param sr_change: change \\in ratio\n :rtype: float \n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_489src = {"src", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_489src, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_488src};
static PyObject *__pyx_pw_8pysndlib_3clm_489src(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = 0;
PyObject *__pyx_v_sr_change = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("src (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gen,&__pyx_n_s_sr_change,0};
PyObject* values[2] = {0,0};
values[1] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)__pyx_float_0_0));
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_gen)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4609, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_sr_change);
if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4609, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "src") < 0)) __PYX_ERR(0, 4609, __pyx_L3_error)
}
} else {
switch (__pyx_nargs) {
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
break;
default: goto __pyx_L5_argtuple_error;
}
}
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)values[0]);
__pyx_v_sr_change = values[1];
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("src", 0, 1, 2, __pyx_nargs); __PYX_ERR(0, 4609, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.src", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gen), __pyx_ptype_8pysndlib_3clm_mus_any, 0, "gen", 0))) __PYX_ERR(0, 4609, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_488src(__pyx_self, __pyx_v_gen, __pyx_v_sr_change);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_488src(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, PyObject *__pyx_v_sr_change) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_2.__pyx_n = 1;
__pyx_t_2.sr_change = __pyx_v_sr_change;
__pyx_t_1 = __pyx_f_8pysndlib_3clm_src(__pyx_v_gen, 0, &__pyx_t_2); if (unlikely(__pyx_t_1 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 4609, __pyx_L1_error)
__pyx_t_3 = PyFloat_FromDouble(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4609, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__pyx_r = __pyx_t_3;
__pyx_t_3 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_3);
__Pyx_AddTraceback("pysndlib.clm.src", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_tuple__543 = PyTuple_Pack(2, __pyx_n_s_gen, __pyx_n_s_sr_change); if (unlikely(!__pyx_tuple__543)) __PYX_ERR(0, 4609, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__543);
__Pyx_GIVEREF(__pyx_tuple__543);
__pyx_codeobj__544 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__543, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_src, 4609, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__544)) __PYX_ERR(0, 4609, __pyx_L1_error)
/* … */
__pyx_t_43 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 4609, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
if (PyDict_SetItem(__pyx_t_43, __pyx_n_s_gen, __pyx_n_s_mus_any) < 0) __PYX_ERR(0, 4609, __pyx_L1_error)
if (PyDict_SetItem(__pyx_t_43, __pyx_n_s_sr_change, __pyx_kp_s_Optional_float) < 0) __PYX_ERR(0, 4609, __pyx_L1_error)
__pyx_t_37 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_489src, 0, __pyx_n_s_src, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__544)); if (unlikely(!__pyx_t_37)) __PYX_ERR(0, 4609, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_37);
__Pyx_CyFunction_SetDefaultsTuple(__pyx_t_37, __pyx_tuple__545);
__Pyx_CyFunction_SetAnnotationsDict(__pyx_t_37, __pyx_t_43);
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
if (PyDict_SetItem(__pyx_d, __pyx_n_s_src, __pyx_t_37) < 0) __PYX_ERR(0, 4609, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_37); __pyx_t_37 = 0;
__pyx_tuple__545 = PyTuple_Pack(1, __pyx_float_0_0); if (unlikely(!__pyx_tuple__545)) __PYX_ERR(0, 4609, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__545);
__Pyx_GIVEREF(__pyx_tuple__545);
/* … */
struct __pyx_opt_args_8pysndlib_3clm_src {
int __pyx_n;
PyObject *sr_change;
};
4610: """
4611: next sampling rate conversion sample. 'pm' can be used to change the sampling rate on a
4612: sample-by-sample basis. 'input-function' is a function of one argument (the current input direction,
4613: normally ignored) that is called internally whenever a new sample of input data is needed. if the
4614: associated make_src included an 'input' argument, input-function is ignored.
4615:
4616: :param gen: src gen
4617: :param sr_change: change \in ratio
4618: :rtype: float
4619: """
+4620: if gen._inputcallback:
__pyx_t_1 = (__pyx_v_gen->_inputcallback != 0);
if (__pyx_t_1) {
/* … */
}
+4621: return cclm.mus_src(gen._ptr, sr_change, <cclm.input_cb>gen._inputcallback)
__pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_v_sr_change); if (unlikely((__pyx_t_2 == ((mus_float_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 4621, __pyx_L1_error) __pyx_r = mus_src(__pyx_v_gen->_ptr, __pyx_t_2, ((input_cb)__pyx_v_gen->_inputcallback)); goto __pyx_L0;
4622: else:
+4623: return 0.0
/*else*/ {
__pyx_r = 0.0;
goto __pyx_L0;
}
4624:
+4625: cpdef bint is_src(gen: mus_any):
static PyObject *__pyx_pw_8pysndlib_3clm_491is_src(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static int __pyx_f_8pysndlib_3clm_is_src(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, CYTHON_UNUSED int __pyx_skip_dispatch) {
int __pyx_r;
/* … */
/* function exit code */
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_491is_src(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_490is_src, "\n returns True if gen is a src.\n \n :param gen: gen\n :rtype: bool\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_491is_src = {"is_src", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_491is_src, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_490is_src};
static PyObject *__pyx_pw_8pysndlib_3clm_491is_src(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("is_src (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gen,0};
PyObject* values[1] = {0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_gen)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4625, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "is_src") < 0)) __PYX_ERR(0, 4625, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 1)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
}
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)values[0]);
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("is_src", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 4625, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.is_src", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gen), __pyx_ptype_8pysndlib_3clm_mus_any, 0, "gen", 0))) __PYX_ERR(0, 4625, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_490is_src(__pyx_self, __pyx_v_gen);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_490is_src(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8pysndlib_3clm_is_src(__pyx_v_gen, 0); if (unlikely(__pyx_t_1 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 4625, __pyx_L1_error)
__pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4625, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("pysndlib.clm.is_src", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_37 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_37)) __PYX_ERR(0, 4625, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_37);
if (PyDict_SetItem(__pyx_t_37, __pyx_n_s_gen, __pyx_n_s_mus_any) < 0) __PYX_ERR(0, 4625, __pyx_L1_error)
__pyx_t_43 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_491is_src, 0, __pyx_n_s_is_src, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__546)); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 4625, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
__Pyx_CyFunction_SetAnnotationsDict(__pyx_t_43, __pyx_t_37);
__Pyx_DECREF(__pyx_t_37); __pyx_t_37 = 0;
if (PyDict_SetItem(__pyx_d, __pyx_n_s_is_src, __pyx_t_43) < 0) __PYX_ERR(0, 4625, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
/* … */
__pyx_codeobj__546 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__56, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_is_src, 4625, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__546)) __PYX_ERR(0, 4625, __pyx_L1_error)
4626: """
4627: returns True if gen is a src.
4628:
4629: :param gen: gen
4630: :rtype: bool
4631: """
+4632: return cclm.mus_is_src(gen._ptr)
__pyx_r = mus_is_src(__pyx_v_gen->_ptr); goto __pyx_L0;
4633:
4634:
4635: # ---------------- convolve ---------------- #
4636:
+4637: def make_convolve(inp, filt, fft_size: Optional[int]=512, filter_size: Optional[int]=None ):
/* Python wrapper */ static PyObject *__pyx_pw_8pysndlib_3clm_493make_convolve(PyObject *__pyx_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_492make_convolve, "\n return a new convolution generator which convolves its input with the impulse response 'filter'.\n \n :param inp: gen or function to read from\n :param filt: np.array of filter \n :param fft_size: fft size used \\in the convolution\n :param filter_size: how much of filter to use. if None use whole filter\n :return: convolve gen\n :rtype: mus_any\n "); static PyMethodDef __pyx_mdef_8pysndlib_3clm_493make_convolve = {"make_convolve", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_493make_convolve, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_492make_convolve}; static PyObject *__pyx_pw_8pysndlib_3clm_493make_convolve(PyObject *__pyx_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { PyObject *__pyx_v_inp = 0; PyObject *__pyx_v_filt = 0; PyObject *__pyx_v_fft_size = 0; PyObject *__pyx_v_filter_size = 0; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("make_convolve (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_MACROS __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { PyObject **__pyx_pyargnames[] = {&__pyx_n_s_inp,&__pyx_n_s_filt,&__pyx_n_s_fft_size,&__pyx_n_s_filter_size,0}; PyObject* values[4] = {0,0,0,0}; values[2] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)((PyObject *)__pyx_int_512))); values[3] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None)); if (__pyx_kwds) { Py_ssize_t kw_args; switch (__pyx_nargs) { case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); CYTHON_FALLTHROUGH; case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); CYTHON_FALLTHROUGH; case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); CYTHON_FALLTHROUGH; case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); switch (__pyx_nargs) { case 0: if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_inp)) != 0)) { (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); kw_args--; } else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4637, __pyx_L3_error) else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_filt)) != 0)) { (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); kw_args--; } else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4637, __pyx_L3_error) else { __Pyx_RaiseArgtupleInvalid("make_convolve", 0, 2, 4, 1); __PYX_ERR(0, 4637, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: if (kw_args > 0) { PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_fft_size); if (value) { values[2] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4637, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 3: if (kw_args > 0) { PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_filter_size); if (value) { values[3] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4637, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { const Py_ssize_t kwd_pos_args = __pyx_nargs; if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "make_convolve") < 0)) __PYX_ERR(0, 4637, __pyx_L3_error) } } else { switch (__pyx_nargs) { case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); CYTHON_FALLTHROUGH; case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); CYTHON_FALLTHROUGH; case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); break; default: goto __pyx_L5_argtuple_error; } } __pyx_v_inp = values[0]; __pyx_v_filt = values[1]; __pyx_v_fft_size = values[2]; __pyx_v_filter_size = values[3]; } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("make_convolve", 0, 2, 4, __pyx_nargs); __PYX_ERR(0, 4637, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; { Py_ssize_t __pyx_temp; for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); } } __Pyx_AddTraceback("pysndlib.clm.make_convolve", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_8pysndlib_3clm_492make_convolve(__pyx_self, __pyx_v_inp, __pyx_v_filt, __pyx_v_fft_size, __pyx_v_filter_size); /* function exit code */ { Py_ssize_t __pyx_temp; for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); } } __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ static PyObject *__pyx_pf_8pysndlib_3clm_492make_convolve(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_inp, PyObject *__pyx_v_filt, PyObject *__pyx_v_fft_size, PyObject *__pyx_v_filter_size) { struct __pyx_obj_8pysndlib_3clm___pyx_scope_struct_2_make_convolve *__pyx_cur_scope; input_cb __pyx_v_cy_input_f_ptr; __Pyx_memviewslice __pyx_v_filt_view = { 0, 0, { 0 }, { 0 }, { 0 } }; PyObject *__pyx_v_fft_len = NULL; struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_res = NULL; PyObject *__pyx_v_inp_f = 0; PyObject *__pyx_r = NULL; __pyx_cur_scope = (struct __pyx_obj_8pysndlib_3clm___pyx_scope_struct_2_make_convolve *)__pyx_tp_new_8pysndlib_3clm___pyx_scope_struct_2_make_convolve(__pyx_ptype_8pysndlib_3clm___pyx_scope_struct_2_make_convolve, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_cur_scope)) { __pyx_cur_scope = ((struct __pyx_obj_8pysndlib_3clm___pyx_scope_struct_2_make_convolve *)Py_None); __Pyx_INCREF(Py_None); __PYX_ERR(0, 4637, __pyx_L1_error) } else { __Pyx_GOTREF((PyObject *)__pyx_cur_scope); } __pyx_cur_scope->__pyx_v_inp = __pyx_v_inp; __Pyx_INCREF(__pyx_cur_scope->__pyx_v_inp); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_inp); __Pyx_INCREF(__pyx_v_filt); __Pyx_INCREF(__pyx_v_fft_size); __Pyx_INCREF(__pyx_v_filter_size); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_8); __PYX_XCLEAR_MEMVIEW(&__pyx_t_10, 1); __Pyx_XDECREF(__pyx_t_14); __Pyx_AddTraceback("pysndlib.clm.make_convolve", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __PYX_XCLEAR_MEMVIEW(&__pyx_v_filt_view, 1); __Pyx_XDECREF(__pyx_v_fft_len); __Pyx_XDECREF((PyObject *)__pyx_v_res); __Pyx_XDECREF(__pyx_v_inp_f); __Pyx_XDECREF(__pyx_v_filt); __Pyx_XDECREF(__pyx_v_fft_size); __Pyx_XDECREF(__pyx_v_filter_size); __Pyx_DECREF((PyObject *)__pyx_cur_scope); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__547 = PyTuple_Pack(10, __pyx_n_s_inp, __pyx_n_s_filt, __pyx_n_s_fft_size, __pyx_n_s_filter_size, __pyx_n_s_cy_input_f_ptr, __pyx_n_s_filt_view, __pyx_n_s_fft_len, __pyx_n_s_res, __pyx_n_s_inp_f, __pyx_n_s_inp_f); if (unlikely(!__pyx_tuple__547)) __PYX_ERR(0, 4637, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__547); __Pyx_GIVEREF(__pyx_tuple__547); __pyx_codeobj__548 = (PyObject*)__Pyx_PyCode_New(4, 0, 0, 10, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__547, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_make_convolve, 4637, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__548)) __PYX_ERR(0, 4637, __pyx_L1_error) /* … */ __pyx_t_43 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 4637, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_43); if (PyDict_SetItem(__pyx_t_43, __pyx_n_s_fft_size, __pyx_kp_s_Optional_int) < 0) __PYX_ERR(0, 4637, __pyx_L1_error) if (PyDict_SetItem(__pyx_t_43, __pyx_n_s_filter_size, __pyx_kp_s_Optional_int) < 0) __PYX_ERR(0, 4637, __pyx_L1_error) __pyx_t_37 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_493make_convolve, 0, __pyx_n_s_make_convolve, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__548)); if (unlikely(!__pyx_t_37)) __PYX_ERR(0, 4637, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_37); __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_37, __pyx_tuple__549); __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_37, __pyx_t_43); __Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0; if (PyDict_SetItem(__pyx_d, __pyx_n_s_make_convolve, __pyx_t_37) < 0) __PYX_ERR(0, 4637, __pyx_L1_error) __Pyx_DECREF(__pyx_t_37); __pyx_t_37 = 0; __pyx_tuple__549 = PyTuple_Pack(2, ((PyObject *)__pyx_int_512), Py_None); if (unlikely(!__pyx_tuple__549)) __PYX_ERR(0, 4637, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__549); __Pyx_GIVEREF(__pyx_tuple__549); /* … */ struct __pyx_obj_8pysndlib_3clm___pyx_scope_struct_2_make_convolve { PyObject_HEAD PyObject *__pyx_v_inp; };
4638: """
4639: return a new convolution generator which convolves its input with the impulse response 'filter'.
4640:
4641: :param inp: gen or function to read from
4642: :param filt: np.array of filter
4643: :param fft_size: fft size used \in the convolution
4644: :param filter_size: how much of filter to use. if None use whole filter
4645: :return: convolve gen
4646: :rtype: mus_any
4647: """
4648:
4649: cdef cclm.input_cb cy_input_f_ptr
4650:
4651: cdef double [:] filt_view
4652:
4653:
+4654: if filter_size is None:
__pyx_t_1 = (__pyx_v_filter_size == Py_None);
if (__pyx_t_1) {
/* … */
}
+4655: filter_size = clm_length(filt)
__pyx_t_2 = __pyx_f_8pysndlib_3clm_clm_length(__pyx_v_filt, 0); if (unlikely(__pyx_t_2 == ((long)-1) && PyErr_Occurred())) __PYX_ERR(0, 4655, __pyx_L1_error) __pyx_t_3 = __Pyx_PyInt_From_long(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4655, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF_SET(__pyx_v_filter_size, __pyx_t_3); __pyx_t_3 = 0;
4656:
+4657: fft_len = 0
__Pyx_INCREF(__pyx_int_0);
__pyx_v_fft_len = __pyx_int_0;
4658:
+4659: if fft_size < 0 or fft_size == 0:
__pyx_t_3 = PyObject_RichCompare(__pyx_v_fft_size, __pyx_int_0, Py_LT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4659, __pyx_L1_error) __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 4659, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (!__pyx_t_4) { } else { __pyx_t_1 = __pyx_t_4; goto __pyx_L5_bool_binop_done; } __pyx_t_4 = (__Pyx_PyInt_BoolEqObjC(__pyx_v_fft_size, __pyx_int_0, 0, 0)); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 4659, __pyx_L1_error) __pyx_t_1 = __pyx_t_4; __pyx_L5_bool_binop_done:; if (unlikely(__pyx_t_1)) { /* … */ }
+4660: raise ValueError(f'fft_size must be a positive number greater than 0 not {fft_size}')
__pyx_t_3 = __Pyx_PyObject_FormatSimple(__pyx_v_fft_size, __pyx_empty_unicode); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4660, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = __Pyx_PyUnicode_Concat(__pyx_kp_u_fft_size_must_be_a_positive_numb, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4660, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4660, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __PYX_ERR(0, 4660, __pyx_L1_error)
4661:
+4662: if fft_size > csndlib.mus_max_malloc():
__pyx_t_3 = __Pyx_PyInt_From_int64_t(mus_max_malloc()); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4662, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = PyObject_RichCompare(__pyx_v_fft_size, __pyx_t_3, Py_GT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4662, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 4662, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (unlikely(__pyx_t_1)) { /* … */ }
+4663: raise ValueError(f'fft_size too large. cannot allocate {fft_size} size fft')
__pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4663, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_6 = 0; __pyx_t_7 = 127; __Pyx_INCREF(__pyx_kp_u_fft_size_too_large_cannot_alloca); __pyx_t_6 += 36; __Pyx_GIVEREF(__pyx_kp_u_fft_size_too_large_cannot_alloca); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_kp_u_fft_size_too_large_cannot_alloca); __pyx_t_3 = __Pyx_PyObject_FormatSimple(__pyx_v_fft_size, __pyx_empty_unicode); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4663, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_7 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3) > __pyx_t_7) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3) : __pyx_t_7; __pyx_t_6 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_3); __pyx_t_3 = 0; __Pyx_INCREF(__pyx_kp_u_size_fft); __pyx_t_6 += 9; __Pyx_GIVEREF(__pyx_kp_u_size_fft); PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_kp_u_size_fft); __pyx_t_3 = __Pyx_PyUnicode_Join(__pyx_t_5, 3, __pyx_t_6, __pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4663, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4663, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_Raise(__pyx_t_5, 0, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __PYX_ERR(0, 4663, __pyx_L1_error)
4664:
+4665: if is_power_of_2(filter_size):
__pyx_t_5 = __pyx_f_8pysndlib_3clm_is_power_of_2(__pyx_v_filter_size, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4665, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 4665, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_1) { /* … */ goto __pyx_L8; }
+4666: fft_len = filter_size * 2
__pyx_t_5 = __Pyx_PyInt_MultiplyObjC(__pyx_v_filter_size, __pyx_int_2, 2, 0, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4666, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF_SET(__pyx_v_fft_len, __pyx_t_5); __pyx_t_5 = 0;
4667: else :
+4668: fft_len = next_power_of_2(filter_size)
/*else*/ {
__pyx_t_5 = __pyx_f_8pysndlib_3clm_next_power_of_2(__pyx_v_filter_size, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4668, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF_SET(__pyx_v_fft_len, __pyx_t_5);
__pyx_t_5 = 0;
}
__pyx_L8:;
4669:
+4670: if fft_size < fft_len:
__pyx_t_5 = PyObject_RichCompare(__pyx_v_fft_size, __pyx_v_fft_len, Py_LT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4670, __pyx_L1_error) __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 4670, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_1) { /* … */ }
+4671: fft_size = fft_len
__Pyx_INCREF(__pyx_v_fft_len); __Pyx_DECREF_SET(__pyx_v_fft_size, __pyx_v_fft_len);
4672:
+4673: if isinstance(filt, list):
__pyx_t_1 = PyList_Check(__pyx_v_filt);
if (__pyx_t_1) {
/* … */
}
+4674: filt = np.array(filt)
__Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4674, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_array); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 4674, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = NULL; __pyx_t_9 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_8))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_8); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_8, function); __pyx_t_9 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v_filt}; __pyx_t_5 = __Pyx_PyObject_FastCall(__pyx_t_8, __pyx_callargs+1-__pyx_t_9, 1+__pyx_t_9); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4674, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; } __Pyx_DECREF_SET(__pyx_v_filt, __pyx_t_5); __pyx_t_5 = 0;
4675:
+4676: check_ndim(filt)
__pyx_t_5 = __pyx_f_8pysndlib_3clm_check_ndim(__pyx_v_filt, 0, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4676, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
4677:
+4678: filt_view = filt
__pyx_t_10 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_v_filt, PyBUF_WRITABLE); if (unlikely(!__pyx_t_10.memview)) __PYX_ERR(0, 4678, __pyx_L1_error) __pyx_v_filt_view = __pyx_t_10; __pyx_t_10.memview = NULL; __pyx_t_10.data = NULL;
4679:
+4680: if(isinstance(inp, mus_any)):
__pyx_t_5 = __pyx_cur_scope->__pyx_v_inp; __Pyx_INCREF(__pyx_t_5); __pyx_t_1 = __Pyx_TypeCheck(__pyx_t_5, __pyx_ptype_8pysndlib_3clm_mus_any); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_1) { /* … */ }
+4681: res = mus_any.from_ptr(cclm.mus_make_convolve(<cclm.input_cb>input_callback_func, &filt_view[0], fft_size, filter_size, <void*>(<mus_any>inp)._ptr))
__pyx_t_11 = 0;
__pyx_t_9 = -1;
if (__pyx_t_11 < 0) {
__pyx_t_11 += __pyx_v_filt_view.shape[0];
if (unlikely(__pyx_t_11 < 0)) __pyx_t_9 = 0;
} else if (unlikely(__pyx_t_11 >= __pyx_v_filt_view.shape[0])) __pyx_t_9 = 0;
if (unlikely(__pyx_t_9 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_9);
__PYX_ERR(0, 4681, __pyx_L1_error)
}
__pyx_t_12 = __Pyx_PyInt_As_int64_t(__pyx_v_fft_size); if (unlikely((__pyx_t_12 == ((mus_long_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 4681, __pyx_L1_error)
__pyx_t_13 = __Pyx_PyInt_As_int64_t(__pyx_v_filter_size); if (unlikely((__pyx_t_13 == ((mus_long_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 4681, __pyx_L1_error)
__pyx_t_5 = ((PyObject *)__pyx_vtabptr_8pysndlib_3clm_mus_any->from_ptr(mus_make_convolve(((input_cb)__pyx_f_8pysndlib_3clm_input_callback_func), (&(*((double *) ( /* dim=0 */ (__pyx_v_filt_view.data + __pyx_t_11 * __pyx_v_filt_view.strides[0]) )))), __pyx_t_12, __pyx_t_13, ((void *)((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_cur_scope->__pyx_v_inp)->_ptr)), NULL)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4681, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_5);
__pyx_v_res = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_t_5);
__pyx_t_5 = 0;
+4682: res._inputcallback = <cclm.input_cb>input_callback_func
__pyx_v_res->_inputcallback = ((input_cb)__pyx_f_8pysndlib_3clm_input_callback_func);
+4683: res.cache_append(filt)
__pyx_t_5 = ((struct __pyx_vtabstruct_8pysndlib_3clm_mus_any *)__pyx_v_res->__pyx_vtab)->cache_append(__pyx_v_res, __pyx_v_filt, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4683, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+4684: return res
__Pyx_XDECREF(__pyx_r); __Pyx_INCREF((PyObject *)__pyx_v_res); __pyx_r = ((PyObject *)__pyx_v_res); goto __pyx_L0;
4685:
+4686: if not callable(inp):
__pyx_t_5 = __pyx_cur_scope->__pyx_v_inp; __Pyx_INCREF(__pyx_t_5); __pyx_t_1 = __Pyx_PyCallable_Check(__pyx_t_5); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 4686, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_4 = (!__pyx_t_1); if (unlikely(__pyx_t_4)) { /* … */ }
+4687: raise TypeError(f"input needs to be a clm gen or function not a {type(inp)}")
__pyx_t_5 = __Pyx_PyObject_FormatSimple(((PyObject *)Py_TYPE(__pyx_cur_scope->__pyx_v_inp)), __pyx_empty_unicode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4687, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_8 = __Pyx_PyUnicode_Concat(__pyx_kp_u_input_needs_to_be_a_clm_gen_or_f, __pyx_t_5); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 4687, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_8); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4687, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_Raise(__pyx_t_5, 0, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __PYX_ERR(0, 4687, __pyx_L1_error)
4688:
+4689: @INPUTCALLBACK
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_13make_convolve_1inp_f(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_8pysndlib_3clm_13make_convolve_1inp_f = {"inp_f", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_13make_convolve_1inp_f, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_8pysndlib_3clm_13make_convolve_1inp_f(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
CYTHON_UNUSED PyObject *__pyx_v_gen = 0;
PyObject *__pyx_v_d = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("inp_f (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gen,&__pyx_n_s_d,0};
PyObject* values[2] = {0,0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_gen)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4689, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_d)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4689, __pyx_L3_error)
else {
__Pyx_RaiseArgtupleInvalid("inp_f", 1, 2, 2, 1); __PYX_ERR(0, 4689, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "inp_f") < 0)) __PYX_ERR(0, 4689, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 2)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
}
__pyx_v_gen = values[0];
__pyx_v_d = values[1];
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("inp_f", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 4689, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.make_convolve.inp_f", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_8pysndlib_3clm_13make_convolve_inp_f(__pyx_self, __pyx_v_gen, __pyx_v_d);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_13make_convolve_inp_f(PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_gen, PyObject *__pyx_v_d) {
struct __pyx_obj_8pysndlib_3clm___pyx_scope_struct_2_make_convolve *__pyx_cur_scope;
struct __pyx_obj_8pysndlib_3clm___pyx_scope_struct_2_make_convolve *__pyx_outer_scope;
PyObject *__pyx_r = NULL;
__pyx_outer_scope = (struct __pyx_obj_8pysndlib_3clm___pyx_scope_struct_2_make_convolve *) __Pyx_CyFunction_GetClosure(__pyx_self);
__pyx_cur_scope = __pyx_outer_scope;
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_AddTraceback("pysndlib.clm.make_convolve.inp_f", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_INPUTCALLBACK); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 4689, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_8);
__pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_13make_convolve_1inp_f, 0, __pyx_n_s_make_convolve_locals_inp_f, ((PyObject*)__pyx_cur_scope), __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__54)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4689, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_14 = NULL;
__pyx_t_9 = 0;
#if CYTHON_UNPACK_METHODS
if (unlikely(PyMethod_Check(__pyx_t_8))) {
__pyx_t_14 = PyMethod_GET_SELF(__pyx_t_8);
if (likely(__pyx_t_14)) {
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
__Pyx_INCREF(__pyx_t_14);
__Pyx_INCREF(function);
__Pyx_DECREF_SET(__pyx_t_8, function);
__pyx_t_9 = 1;
}
}
#endif
{
PyObject *__pyx_callargs[2] = {__pyx_t_14, __pyx_t_3};
__pyx_t_5 = __Pyx_PyObject_FastCall(__pyx_t_8, __pyx_callargs+1-__pyx_t_9, 1+__pyx_t_9);
__Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4689, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
}
__pyx_v_inp_f = __pyx_t_5;
__pyx_t_5 = 0;
/* … */
__pyx_codeobj__54 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__52, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_inp_f, 4689, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__54)) __PYX_ERR(0, 4689, __pyx_L1_error)
4690: def inp_f(gen, d):
+4691: return inp(d)
__Pyx_XDECREF(__pyx_r); if (unlikely(!__pyx_cur_scope->__pyx_v_inp)) { __Pyx_RaiseClosureNameError("inp"); __PYX_ERR(0, 4691, __pyx_L1_error) } __Pyx_INCREF(__pyx_cur_scope->__pyx_v_inp); __pyx_t_2 = __pyx_cur_scope->__pyx_v_inp; __pyx_t_3 = NULL; __pyx_t_4 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_2))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); __pyx_t_4 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v_d}; __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4691, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
4692:
+4693: inp_f = INPUTCALLBACK(inp)
__Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_INPUTCALLBACK); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 4693, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __pyx_t_3 = NULL; __pyx_t_9 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_8))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_8); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_8, function); __pyx_t_9 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_cur_scope->__pyx_v_inp}; __pyx_t_5 = __Pyx_PyObject_FastCall(__pyx_t_8, __pyx_callargs+1-__pyx_t_9, 1+__pyx_t_9); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4693, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; } __Pyx_DECREF_SET(__pyx_v_inp_f, __pyx_t_5); __pyx_t_5 = 0;
+4694: cy_input_f_ptr = (<cclm.input_cb*><size_t>ctypes.addressof(inp_f))[0]
__Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_ctypes); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 4694, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_addressof); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4694, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __pyx_t_8 = NULL; __pyx_t_9 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_3))) { __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_8)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_8); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); __pyx_t_9 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_8, __pyx_v_inp_f}; __pyx_t_5 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_9, 1+__pyx_t_9); __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4694, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } __pyx_t_15 = __Pyx_PyInt_As_size_t(__pyx_t_5); if (unlikely((__pyx_t_15 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 4694, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_v_cy_input_f_ptr = (((input_cb *)((size_t)__pyx_t_15))[0]);
+4695: res = mus_any.from_ptr(cclm.mus_make_convolve(cy_input_f_ptr, &filt_view[0], fft_size, filter_size, NULL))
__pyx_t_11 = 0;
__pyx_t_9 = -1;
if (__pyx_t_11 < 0) {
__pyx_t_11 += __pyx_v_filt_view.shape[0];
if (unlikely(__pyx_t_11 < 0)) __pyx_t_9 = 0;
} else if (unlikely(__pyx_t_11 >= __pyx_v_filt_view.shape[0])) __pyx_t_9 = 0;
if (unlikely(__pyx_t_9 != -1)) {
__Pyx_RaiseBufferIndexError(__pyx_t_9);
__PYX_ERR(0, 4695, __pyx_L1_error)
}
__pyx_t_13 = __Pyx_PyInt_As_int64_t(__pyx_v_fft_size); if (unlikely((__pyx_t_13 == ((mus_long_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 4695, __pyx_L1_error)
__pyx_t_12 = __Pyx_PyInt_As_int64_t(__pyx_v_filter_size); if (unlikely((__pyx_t_12 == ((mus_long_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 4695, __pyx_L1_error)
__pyx_t_5 = ((PyObject *)__pyx_vtabptr_8pysndlib_3clm_mus_any->from_ptr(mus_make_convolve(__pyx_v_cy_input_f_ptr, (&(*((double *) ( /* dim=0 */ (__pyx_v_filt_view.data + __pyx_t_11 * __pyx_v_filt_view.strides[0]) )))), __pyx_t_13, __pyx_t_12, NULL), NULL)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4695, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_5);
__pyx_v_res = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_t_5);
__pyx_t_5 = 0;
+4696: res._inputcallback = cy_input_f_ptr
__pyx_v_res->_inputcallback = __pyx_v_cy_input_f_ptr;
+4697: res.cache_append(inp_f)
__pyx_t_5 = ((struct __pyx_vtabstruct_8pysndlib_3clm_mus_any *)__pyx_v_res->__pyx_vtab)->cache_append(__pyx_v_res, __pyx_v_inp_f, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4697, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
4698:
+4699: return res
__Pyx_XDECREF(__pyx_r); __Pyx_INCREF((PyObject *)__pyx_v_res); __pyx_r = ((PyObject *)__pyx_v_res); goto __pyx_L0;
4700:
4701:
+4702: cpdef cython.double convolve(gen: mus_any):
static PyObject *__pyx_pw_8pysndlib_3clm_495convolve(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static double __pyx_f_8pysndlib_3clm_convolve(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, CYTHON_UNUSED int __pyx_skip_dispatch) {
double __pyx_r;
/* … */
/* function exit code */
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_495convolve(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_494convolve, "\n next sample from convolution generator.\n \n :param gen: convolve gen\n :rtype: float\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_495convolve = {"convolve", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_495convolve, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_494convolve};
static PyObject *__pyx_pw_8pysndlib_3clm_495convolve(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("convolve (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gen,0};
PyObject* values[1] = {0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_gen)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4702, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "convolve") < 0)) __PYX_ERR(0, 4702, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 1)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
}
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)values[0]);
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("convolve", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 4702, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.convolve", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gen), __pyx_ptype_8pysndlib_3clm_mus_any, 0, "gen", 0))) __PYX_ERR(0, 4702, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_494convolve(__pyx_self, __pyx_v_gen);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_494convolve(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8pysndlib_3clm_convolve(__pyx_v_gen, 0); if (unlikely(__pyx_t_1 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 4702, __pyx_L1_error)
__pyx_t_2 = PyFloat_FromDouble(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4702, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("pysndlib.clm.convolve", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_37 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_37)) __PYX_ERR(0, 4702, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_37);
if (PyDict_SetItem(__pyx_t_37, __pyx_n_s_gen, __pyx_n_s_mus_any) < 0) __PYX_ERR(0, 4702, __pyx_L1_error)
__pyx_t_43 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_495convolve, 0, __pyx_n_s_convolve, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__550)); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 4702, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
__Pyx_CyFunction_SetAnnotationsDict(__pyx_t_43, __pyx_t_37);
__Pyx_DECREF(__pyx_t_37); __pyx_t_37 = 0;
if (PyDict_SetItem(__pyx_d, __pyx_n_s_convolve, __pyx_t_43) < 0) __PYX_ERR(0, 4702, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
/* … */
__pyx_codeobj__550 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__56, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_convolve, 4702, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__550)) __PYX_ERR(0, 4702, __pyx_L1_error)
4703: """
4704: next sample from convolution generator.
4705:
4706: :param gen: convolve gen
4707: :rtype: float
4708: """
+4709: return cclm.mus_convolve(gen._ptr, gen._inputcallback)
__pyx_r = mus_convolve(__pyx_v_gen->_ptr, __pyx_v_gen->_inputcallback); goto __pyx_L0;
4710:
+4711: cpdef bint is_convolve(gen: mus_any):
static PyObject *__pyx_pw_8pysndlib_3clm_497is_convolve(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static int __pyx_f_8pysndlib_3clm_is_convolve(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, CYTHON_UNUSED int __pyx_skip_dispatch) {
int __pyx_r;
/* … */
/* function exit code */
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_497is_convolve(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_496is_convolve, "\n returns True if gen is a convolve.\n \n :param gen: gen\n :rtype: bool\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_497is_convolve = {"is_convolve", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_497is_convolve, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_496is_convolve};
static PyObject *__pyx_pw_8pysndlib_3clm_497is_convolve(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("is_convolve (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gen,0};
PyObject* values[1] = {0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_gen)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4711, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "is_convolve") < 0)) __PYX_ERR(0, 4711, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 1)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
}
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)values[0]);
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("is_convolve", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 4711, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.is_convolve", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gen), __pyx_ptype_8pysndlib_3clm_mus_any, 0, "gen", 0))) __PYX_ERR(0, 4711, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_496is_convolve(__pyx_self, __pyx_v_gen);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_496is_convolve(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8pysndlib_3clm_is_convolve(__pyx_v_gen, 0); if (unlikely(__pyx_t_1 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 4711, __pyx_L1_error)
__pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4711, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("pysndlib.clm.is_convolve", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_43 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 4711, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
if (PyDict_SetItem(__pyx_t_43, __pyx_n_s_gen, __pyx_n_s_mus_any) < 0) __PYX_ERR(0, 4711, __pyx_L1_error)
__pyx_t_37 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_497is_convolve, 0, __pyx_n_s_is_convolve, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__551)); if (unlikely(!__pyx_t_37)) __PYX_ERR(0, 4711, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_37);
__Pyx_CyFunction_SetAnnotationsDict(__pyx_t_37, __pyx_t_43);
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
if (PyDict_SetItem(__pyx_d, __pyx_n_s_is_convolve, __pyx_t_37) < 0) __PYX_ERR(0, 4711, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_37); __pyx_t_37 = 0;
/* … */
__pyx_codeobj__551 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__56, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_is_convolve, 4711, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__551)) __PYX_ERR(0, 4711, __pyx_L1_error)
4712: """
4713: returns True if gen is a convolve.
4714:
4715: :param gen: gen
4716: :rtype: bool
4717: """
+4718: return cclm.mus_is_convolve(gen._ptr)
__pyx_r = mus_is_convolve(__pyx_v_gen->_ptr); goto __pyx_L0;
4719:
4720:
4721: # --------------- granulate ----------------
+4722: def make_granulate(inp,
/* Python wrapper */ static PyObject *__pyx_pw_8pysndlib_3clm_499make_granulate(PyObject *__pyx_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_498make_granulate, "\n return a new granular synthesis generator. 'length' is the grain length (seconds), 'expansion' is the\n ratio \\in timing between the new and old (expansion > 1.0 slows things down), 'scaler' scales the grains\n to avoid overflows, 'hop' is the spacing (seconds) between successive grains upon output. 'jitter'\n controls the randomness \\in that spacing, 'input' can be a file pointer. 'edit' can be a function of one\n arg, the current granulate generator. it is called just before a grain is added into the output\n buffer. the current grain is accessible via mus_data. the edit function, if any, should return the\n length \\in samples of the grain, or 0.\n \n :param inp: gen or function to read from. if a callback, the function takes 1 input, the direction and should return read value\n :param expansion: how much to lengthen or compress the file\n :param length: length of file slices that are overlapped\n :param scaler: amplitude scaler on slices (to avoid overflows)\n :param hop: speed at which slices are repeated \\in output\n :param ramp: amount of slice-time spent ramping up/down\n :param jitter: affects spacing of successive grains\n :param max_size: internal buffer size\n :param edit: grain editing function. the function should take one argument, the granulate mus_any and return length of grain or 0\n\n "); static PyMethodDef __pyx_mdef_8pysndlib_3clm_499make_granulate = {"make_granulate", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_499make_granulate, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_498make_granulate}; static PyObject *__pyx_pw_8pysndlib_3clm_499make_granulate(PyObject *__pyx_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { PyObject *__pyx_v_inp = 0; PyObject *__pyx_v_expansion = 0; PyObject *__pyx_v_length = 0; PyObject *__pyx_v_scaler = 0; PyObject *__pyx_v_hop = 0; PyObject *__pyx_v_ramp = 0; PyObject *__pyx_v_jitter = 0; PyObject *__pyx_v_max_size = 0; PyObject *__pyx_v_edit = 0; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("make_granulate (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_MACROS __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { PyObject **__pyx_pyargnames[] = {&__pyx_n_s_inp,&__pyx_n_s_expansion,&__pyx_n_s_length,&__pyx_n_s_scaler,&__pyx_n_s_hop,&__pyx_n_s_ramp,&__pyx_n_s_jitter,&__pyx_n_s_max_size,&__pyx_n_s_edit,0}; PyObject* values[9] = {0,0,0,0,0,0,0,0,0}; values[1] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)((PyObject*)__pyx_float_1_0))); values[2] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)((PyObject*)__pyx_float__15))); values[3] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)((PyObject*)__pyx_float__6))); values[4] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)((PyObject*)__pyx_float__05))); values[5] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)((PyObject*)__pyx_float__4))); values[6] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)((PyObject*)__pyx_float_0_0))); values[7] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)((PyObject *)__pyx_int_0))); /* … */ /* function exit code */ { Py_ssize_t __pyx_temp; for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); } } __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ static PyObject *__pyx_pf_8pysndlib_3clm_498make_granulate(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_inp, PyObject *__pyx_v_expansion, PyObject *__pyx_v_length, PyObject *__pyx_v_scaler, PyObject *__pyx_v_hop, PyObject *__pyx_v_ramp, PyObject *__pyx_v_jitter, PyObject *__pyx_v_max_size, PyObject *__pyx_v_edit) { struct __pyx_obj_8pysndlib_3clm___pyx_scope_struct_3_make_granulate *__pyx_cur_scope; edit_cb __pyx_v_cy_edit_f_ptr; PyObject *__pyx_v_inp_f = 0; input_cb __pyx_v_cy_inp_f_ptr; PyObject *__pyx_v_edit_f = 0; PyObject *__pyx_r = NULL; __pyx_cur_scope = (struct __pyx_obj_8pysndlib_3clm___pyx_scope_struct_3_make_granulate *)__pyx_tp_new_8pysndlib_3clm___pyx_scope_struct_3_make_granulate(__pyx_ptype_8pysndlib_3clm___pyx_scope_struct_3_make_granulate, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_cur_scope)) { __pyx_cur_scope = ((struct __pyx_obj_8pysndlib_3clm___pyx_scope_struct_3_make_granulate *)Py_None); __Pyx_INCREF(Py_None); __PYX_ERR(0, 4722, __pyx_L1_error) } else { __Pyx_GOTREF((PyObject *)__pyx_cur_scope); } __pyx_cur_scope->__pyx_v_inp = __pyx_v_inp; __Pyx_INCREF(__pyx_cur_scope->__pyx_v_inp); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_inp); __pyx_cur_scope->__pyx_v_edit = __pyx_v_edit; __Pyx_INCREF(__pyx_cur_scope->__pyx_v_edit); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_edit); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_11); __Pyx_XDECREF(__pyx_t_12); __Pyx_XDECREF(__pyx_t_13); __Pyx_AddTraceback("pysndlib.clm.make_granulate", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_inp_f); __Pyx_XDECREF(__pyx_v_edit_f); __Pyx_DECREF((PyObject *)__pyx_cur_scope); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__552 = PyTuple_Pack(17, __pyx_n_s_inp, __pyx_n_s_expansion, __pyx_n_s_length, __pyx_n_s_scaler, __pyx_n_s_hop, __pyx_n_s_ramp, __pyx_n_s_jitter, __pyx_n_s_max_size, __pyx_n_s_edit, __pyx_n_s_cy_input_f_ptr, __pyx_n_s_cy_edit_f_ptr, __pyx_n_s_res, __pyx_n_s_inp_f, __pyx_n_s_inp_f, __pyx_n_s_cy_inp_f_ptr, __pyx_n_s_edit_f, __pyx_n_s_edit_f); if (unlikely(!__pyx_tuple__552)) __PYX_ERR(0, 4722, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__552); __Pyx_GIVEREF(__pyx_tuple__552); __pyx_codeobj__553 = (PyObject*)__Pyx_PyCode_New(9, 0, 0, 17, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__552, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_make_granulate, 4722, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__553)) __PYX_ERR(0, 4722, __pyx_L1_error) /* … */ __pyx_t_37 = __Pyx_PyDict_NewPresized(7); if (unlikely(!__pyx_t_37)) __PYX_ERR(0, 4722, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_37); if (PyDict_SetItem(__pyx_t_37, __pyx_n_s_expansion, __pyx_kp_s_Optional_float) < 0) __PYX_ERR(0, 4722, __pyx_L1_error) if (PyDict_SetItem(__pyx_t_37, __pyx_n_s_length, __pyx_kp_s_Optional_float) < 0) __PYX_ERR(0, 4722, __pyx_L1_error) if (PyDict_SetItem(__pyx_t_37, __pyx_n_s_scaler, __pyx_kp_s_Optional_float) < 0) __PYX_ERR(0, 4722, __pyx_L1_error) if (PyDict_SetItem(__pyx_t_37, __pyx_n_s_hop, __pyx_kp_s_Optional_float) < 0) __PYX_ERR(0, 4722, __pyx_L1_error) if (PyDict_SetItem(__pyx_t_37, __pyx_n_s_ramp, __pyx_kp_s_Optional_float) < 0) __PYX_ERR(0, 4722, __pyx_L1_error) if (PyDict_SetItem(__pyx_t_37, __pyx_n_s_jitter, __pyx_kp_s_Optional_float) < 0) __PYX_ERR(0, 4722, __pyx_L1_error) if (PyDict_SetItem(__pyx_t_37, __pyx_n_s_max_size, __pyx_kp_s_Optional_int) < 0) __PYX_ERR(0, 4722, __pyx_L1_error) __pyx_t_43 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_499make_granulate, 0, __pyx_n_s_make_granulate, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__553)); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 4722, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_43); __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_43, __pyx_tuple__554); __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_43, __pyx_t_37); __Pyx_DECREF(__pyx_t_37); __pyx_t_37 = 0; if (PyDict_SetItem(__pyx_d, __pyx_n_s_make_granulate, __pyx_t_43) < 0) __PYX_ERR(0, 4722, __pyx_L1_error) __Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0; __pyx_tuple__554 = PyTuple_Pack(8, ((PyObject*)__pyx_float_1_0), ((PyObject*)__pyx_float__15), ((PyObject*)__pyx_float__6), ((PyObject*)__pyx_float__05), ((PyObject*)__pyx_float__4), ((PyObject*)__pyx_float_0_0), ((PyObject *)__pyx_int_0), Py_None); if (unlikely(!__pyx_tuple__554)) __PYX_ERR(0, 4722, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__554); __Pyx_GIVEREF(__pyx_tuple__554); /* … */ struct __pyx_obj_8pysndlib_3clm___pyx_scope_struct_3_make_granulate { PyObject_HEAD PyObject *__pyx_v_edit; PyObject *__pyx_v_inp; struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_res; };
4723: expansion: Optional[float]=1.0,
4724: length: Optional[float]=.15,
4725: scaler: Optional[float]=.6,
4726: hop: Optional[float]=.05,
4727: ramp: Optional[float]=.4,
4728: jitter: Optional[float]=0.0,
4729: max_size: Optional[int]=0,
+4730: edit=None):
values[8] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None)); if (__pyx_kwds) { Py_ssize_t kw_args; switch (__pyx_nargs) { case 9: values[8] = __Pyx_Arg_FASTCALL(__pyx_args, 8); CYTHON_FALLTHROUGH; case 8: values[7] = __Pyx_Arg_FASTCALL(__pyx_args, 7); CYTHON_FALLTHROUGH; case 7: values[6] = __Pyx_Arg_FASTCALL(__pyx_args, 6); CYTHON_FALLTHROUGH; case 6: values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); CYTHON_FALLTHROUGH; case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); CYTHON_FALLTHROUGH; case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); CYTHON_FALLTHROUGH; case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); CYTHON_FALLTHROUGH; case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); CYTHON_FALLTHROUGH; case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); switch (__pyx_nargs) { case 0: if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_inp)) != 0)) { (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); kw_args--; } else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4722, __pyx_L3_error) else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: if (kw_args > 0) { PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_expansion); if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4722, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: if (kw_args > 0) { PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_length); if (value) { values[2] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4722, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 3: if (kw_args > 0) { PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_scaler); if (value) { values[3] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4722, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 4: if (kw_args > 0) { PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_hop); if (value) { values[4] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4722, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 5: if (kw_args > 0) { PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_ramp); if (value) { values[5] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4722, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 6: if (kw_args > 0) { PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_jitter); if (value) { values[6] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4722, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 7: if (kw_args > 0) { PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_max_size); if (value) { values[7] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4722, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 8: if (kw_args > 0) { PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_edit); if (value) { values[8] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4722, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { const Py_ssize_t kwd_pos_args = __pyx_nargs; if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "make_granulate") < 0)) __PYX_ERR(0, 4722, __pyx_L3_error) } } else { switch (__pyx_nargs) { case 9: values[8] = __Pyx_Arg_FASTCALL(__pyx_args, 8); CYTHON_FALLTHROUGH; case 8: values[7] = __Pyx_Arg_FASTCALL(__pyx_args, 7); CYTHON_FALLTHROUGH; case 7: values[6] = __Pyx_Arg_FASTCALL(__pyx_args, 6); CYTHON_FALLTHROUGH; case 6: values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); CYTHON_FALLTHROUGH; case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); CYTHON_FALLTHROUGH; case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); CYTHON_FALLTHROUGH; case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); CYTHON_FALLTHROUGH; case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); CYTHON_FALLTHROUGH; case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); break; default: goto __pyx_L5_argtuple_error; } } __pyx_v_inp = values[0]; __pyx_v_expansion = values[1]; __pyx_v_length = values[2]; __pyx_v_scaler = values[3]; __pyx_v_hop = values[4]; __pyx_v_ramp = values[5]; __pyx_v_jitter = values[6]; __pyx_v_max_size = values[7]; __pyx_v_edit = values[8]; } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("make_granulate", 0, 1, 9, __pyx_nargs); __PYX_ERR(0, 4722, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; { Py_ssize_t __pyx_temp; for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); } } __Pyx_AddTraceback("pysndlib.clm.make_granulate", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_8pysndlib_3clm_498make_granulate(__pyx_self, __pyx_v_inp, __pyx_v_expansion, __pyx_v_length, __pyx_v_scaler, __pyx_v_hop, __pyx_v_ramp, __pyx_v_jitter, __pyx_v_max_size, __pyx_v_edit);
4731:
4732: """
4733: return a new granular synthesis generator. 'length' is the grain length (seconds), 'expansion' is the
4734: ratio \in timing between the new and old (expansion > 1.0 slows things down), 'scaler' scales the grains
4735: to avoid overflows, 'hop' is the spacing (seconds) between successive grains upon output. 'jitter'
4736: controls the randomness \in that spacing, 'input' can be a file pointer. 'edit' can be a function of one
4737: arg, the current granulate generator. it is called just before a grain is added into the output
4738: buffer. the current grain is accessible via mus_data. the edit function, if any, should return the
4739: length \in samples of the grain, or 0.
4740:
4741: :param inp: gen or function to read from. if a callback, the function takes 1 input, the direction and should return read value
4742: :param expansion: how much to lengthen or compress the file
4743: :param length: length of file slices that are overlapped
4744: :param scaler: amplitude scaler on slices (to avoid overflows)
4745: :param hop: speed at which slices are repeated \in output
4746: :param ramp: amount of slice-time spent ramping up/down
4747: :param jitter: affects spacing of successive grains
4748: :param max_size: internal buffer size
4749: :param edit: grain editing function. the function should take one argument, the granulate mus_any and return length of grain or 0
4750:
4751: """
4752:
4753: cdef cclm.input_cb cy_input_f_ptr
4754: cdef cclm.edit_cb cy_edit_f_ptr
4755:
+4756: if(isinstance(inp, mus_any) and edit is None):
__pyx_t_2 = __pyx_cur_scope->__pyx_v_inp; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = __Pyx_TypeCheck(__pyx_t_2, __pyx_ptype_8pysndlib_3clm_mus_any); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__pyx_t_3) { } else { __pyx_t_1 = __pyx_t_3; goto __pyx_L4_bool_binop_done; } __pyx_t_3 = (__pyx_cur_scope->__pyx_v_edit == Py_None); __pyx_t_1 = __pyx_t_3; __pyx_L4_bool_binop_done:; if (__pyx_t_1) { /* … */ }
+4757: res = mus_any.from_ptr(cclm.mus_make_granulate(<cclm.input_cb>input_callback_func, expansion, length, scaler, hop, ramp, jitter, max_size, NULL, <void*>(<mus_any>inp)._ptr))
__pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_v_expansion); if (unlikely((__pyx_t_4 == ((mus_float_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 4757, __pyx_L1_error) __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_v_length); if (unlikely((__pyx_t_5 == ((mus_float_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 4757, __pyx_L1_error) __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_v_scaler); if (unlikely((__pyx_t_6 == ((mus_float_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 4757, __pyx_L1_error) __pyx_t_7 = __pyx_PyFloat_AsDouble(__pyx_v_hop); if (unlikely((__pyx_t_7 == ((mus_float_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 4757, __pyx_L1_error) __pyx_t_8 = __pyx_PyFloat_AsDouble(__pyx_v_ramp); if (unlikely((__pyx_t_8 == ((mus_float_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 4757, __pyx_L1_error) __pyx_t_9 = __pyx_PyFloat_AsDouble(__pyx_v_jitter); if (unlikely((__pyx_t_9 == ((mus_float_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 4757, __pyx_L1_error) __pyx_t_10 = __Pyx_PyInt_As_int(__pyx_v_max_size); if (unlikely((__pyx_t_10 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 4757, __pyx_L1_error) __pyx_t_2 = ((PyObject *)__pyx_vtabptr_8pysndlib_3clm_mus_any->from_ptr(mus_make_granulate(((input_cb)__pyx_f_8pysndlib_3clm_input_callback_func), __pyx_t_4, __pyx_t_5, __pyx_t_6, __pyx_t_7, __pyx_t_8, __pyx_t_9, __pyx_t_10, NULL, ((void *)((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_cur_scope->__pyx_v_inp)->_ptr)), NULL)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4757, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_cur_scope->__pyx_v_res = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_t_2); __pyx_t_2 = 0;
+4758: res._inputcallback = <cclm.input_cb>input_callback_func
__pyx_cur_scope->__pyx_v_res->_inputcallback = ((input_cb)__pyx_f_8pysndlib_3clm_input_callback_func);
+4759: return res
__Pyx_XDECREF(__pyx_r); __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_res); __pyx_r = ((PyObject *)__pyx_cur_scope->__pyx_v_res); goto __pyx_L0;
4760:
+4761: if not callable(inp):
__pyx_t_2 = __pyx_cur_scope->__pyx_v_inp; __Pyx_INCREF(__pyx_t_2); __pyx_t_1 = __Pyx_PyCallable_Check(__pyx_t_2); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 4761, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_3 = (!__pyx_t_1); if (unlikely(__pyx_t_3)) { /* … */ }
+4762: raise TypeError(f"input needs to be a clm gen or function not a {type(inp)}")
__pyx_t_2 = __Pyx_PyObject_FormatSimple(((PyObject *)Py_TYPE(__pyx_cur_scope->__pyx_v_inp)), __pyx_empty_unicode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4762, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_11 = __Pyx_PyUnicode_Concat(__pyx_kp_u_input_needs_to_be_a_clm_gen_or_f, __pyx_t_2); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 4762, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_11); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4762, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __PYX_ERR(0, 4762, __pyx_L1_error)
4763:
+4764: @INPUTCALLBACK
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_14make_granulate_1inp_f(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_8pysndlib_3clm_14make_granulate_1inp_f = {"inp_f", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_14make_granulate_1inp_f, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_8pysndlib_3clm_14make_granulate_1inp_f(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
CYTHON_UNUSED PyObject *__pyx_v_gen = 0;
PyObject *__pyx_v_d = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("inp_f (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gen,&__pyx_n_s_d,0};
PyObject* values[2] = {0,0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_gen)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4764, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_d)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4764, __pyx_L3_error)
else {
__Pyx_RaiseArgtupleInvalid("inp_f", 1, 2, 2, 1); __PYX_ERR(0, 4764, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "inp_f") < 0)) __PYX_ERR(0, 4764, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 2)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
}
__pyx_v_gen = values[0];
__pyx_v_d = values[1];
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("inp_f", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 4764, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.make_granulate.inp_f", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_8pysndlib_3clm_14make_granulate_inp_f(__pyx_self, __pyx_v_gen, __pyx_v_d);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_14make_granulate_inp_f(PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_gen, PyObject *__pyx_v_d) {
struct __pyx_obj_8pysndlib_3clm___pyx_scope_struct_3_make_granulate *__pyx_cur_scope;
struct __pyx_obj_8pysndlib_3clm___pyx_scope_struct_3_make_granulate *__pyx_outer_scope;
PyObject *__pyx_r = NULL;
__pyx_outer_scope = (struct __pyx_obj_8pysndlib_3clm___pyx_scope_struct_3_make_granulate *) __Pyx_CyFunction_GetClosure(__pyx_self);
__pyx_cur_scope = __pyx_outer_scope;
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_AddTraceback("pysndlib.clm.make_granulate.inp_f", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_INPUTCALLBACK); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 4764, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_11);
__pyx_t_12 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_14make_granulate_1inp_f, 0, __pyx_n_s_make_granulate_locals_inp_f, ((PyObject*)__pyx_cur_scope), __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__55)); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 4764, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_12);
__pyx_t_13 = NULL;
__pyx_t_10 = 0;
#if CYTHON_UNPACK_METHODS
if (unlikely(PyMethod_Check(__pyx_t_11))) {
__pyx_t_13 = PyMethod_GET_SELF(__pyx_t_11);
if (likely(__pyx_t_13)) {
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11);
__Pyx_INCREF(__pyx_t_13);
__Pyx_INCREF(function);
__Pyx_DECREF_SET(__pyx_t_11, function);
__pyx_t_10 = 1;
}
}
#endif
{
PyObject *__pyx_callargs[2] = {__pyx_t_13, __pyx_t_12};
__pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_11, __pyx_callargs+1-__pyx_t_10, 1+__pyx_t_10);
__Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
__Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4764, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
}
__pyx_v_inp_f = __pyx_t_2;
__pyx_t_2 = 0;
/* … */
__pyx_codeobj__55 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__52, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_inp_f, 4764, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__55)) __PYX_ERR(0, 4764, __pyx_L1_error)
4765: def inp_f(gen, d):
+4766: return inp(d)
__Pyx_XDECREF(__pyx_r); if (unlikely(!__pyx_cur_scope->__pyx_v_inp)) { __Pyx_RaiseClosureNameError("inp"); __PYX_ERR(0, 4766, __pyx_L1_error) } __Pyx_INCREF(__pyx_cur_scope->__pyx_v_inp); __pyx_t_2 = __pyx_cur_scope->__pyx_v_inp; __pyx_t_3 = NULL; __pyx_t_4 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_2))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); __pyx_t_4 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v_d}; __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4766, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
4767:
4768:
+4769: cy_inp_f_ptr = (<cclm.input_cb*><size_t>ctypes.addressof(inp_f))[0]
__Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_ctypes); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 4769, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_addressof); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 4769, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_12); __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; __pyx_t_11 = NULL; __pyx_t_10 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_12))) { __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_12); if (likely(__pyx_t_11)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12); __Pyx_INCREF(__pyx_t_11); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_12, function); __pyx_t_10 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_11, __pyx_v_inp_f}; __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_12, __pyx_callargs+1-__pyx_t_10, 1+__pyx_t_10); __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4769, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; } __pyx_t_14 = __Pyx_PyInt_As_size_t(__pyx_t_2); if (unlikely((__pyx_t_14 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 4769, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v_cy_inp_f_ptr = (((input_cb *)((size_t)__pyx_t_14))[0]);
+4770: res = mus_any.from_ptr(cclm.mus_make_granulate(<cclm.input_cb>cy_inp_f_ptr, expansion, length, scaler, hop, ramp, jitter, max_size, NULL, NULL))
__pyx_t_9 = __pyx_PyFloat_AsDouble(__pyx_v_expansion); if (unlikely((__pyx_t_9 == ((mus_float_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 4770, __pyx_L1_error) __pyx_t_8 = __pyx_PyFloat_AsDouble(__pyx_v_length); if (unlikely((__pyx_t_8 == ((mus_float_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 4770, __pyx_L1_error) __pyx_t_7 = __pyx_PyFloat_AsDouble(__pyx_v_scaler); if (unlikely((__pyx_t_7 == ((mus_float_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 4770, __pyx_L1_error) __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_v_hop); if (unlikely((__pyx_t_6 == ((mus_float_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 4770, __pyx_L1_error) __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_v_ramp); if (unlikely((__pyx_t_5 == ((mus_float_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 4770, __pyx_L1_error) __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_v_jitter); if (unlikely((__pyx_t_4 == ((mus_float_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 4770, __pyx_L1_error) __pyx_t_10 = __Pyx_PyInt_As_int(__pyx_v_max_size); if (unlikely((__pyx_t_10 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 4770, __pyx_L1_error) __pyx_t_2 = ((PyObject *)__pyx_vtabptr_8pysndlib_3clm_mus_any->from_ptr(mus_make_granulate(((input_cb)__pyx_v_cy_inp_f_ptr), __pyx_t_9, __pyx_t_8, __pyx_t_7, __pyx_t_6, __pyx_t_5, __pyx_t_4, __pyx_t_10, NULL, NULL), NULL)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4770, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_cur_scope->__pyx_v_res = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_t_2); __pyx_t_2 = 0;
+4771: res._inputcallback = cy_inp_f_ptr
__pyx_cur_scope->__pyx_v_res->_inputcallback = __pyx_v_cy_inp_f_ptr;
+4772: res.cache_append(inp_f)
__pyx_t_2 = ((struct __pyx_vtabstruct_8pysndlib_3clm_mus_any *)__pyx_cur_scope->__pyx_v_res->__pyx_vtab)->cache_append(__pyx_cur_scope->__pyx_v_res, __pyx_v_inp_f, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4772, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4773:
+4774: if(edit is None):
__pyx_t_3 = (__pyx_cur_scope->__pyx_v_edit == Py_None);
if (__pyx_t_3) {
/* … */
}
+4775: return res
__Pyx_XDECREF(__pyx_r); __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_res); __pyx_r = ((PyObject *)__pyx_cur_scope->__pyx_v_res); goto __pyx_L0;
4776:
+4777: @EDITCALLBACK
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_14make_granulate_3edit_f(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_8pysndlib_3clm_14make_granulate_3edit_f = {"edit_f", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_14make_granulate_3edit_f, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_8pysndlib_3clm_14make_granulate_3edit_f(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
CYTHON_UNUSED PyObject *__pyx_v_gen = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("edit_f (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gen,0};
PyObject* values[1] = {0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_gen)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4777, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "edit_f") < 0)) __PYX_ERR(0, 4777, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 1)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
}
__pyx_v_gen = values[0];
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("edit_f", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 4777, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.make_granulate.edit_f", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_8pysndlib_3clm_14make_granulate_2edit_f(__pyx_self, __pyx_v_gen);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_14make_granulate_2edit_f(PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_gen) {
struct __pyx_obj_8pysndlib_3clm___pyx_scope_struct_3_make_granulate *__pyx_cur_scope;
struct __pyx_obj_8pysndlib_3clm___pyx_scope_struct_3_make_granulate *__pyx_outer_scope;
PyObject *__pyx_r = NULL;
__pyx_outer_scope = (struct __pyx_obj_8pysndlib_3clm___pyx_scope_struct_3_make_granulate *) __Pyx_CyFunction_GetClosure(__pyx_self);
__pyx_cur_scope = __pyx_outer_scope;
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_AddTraceback("pysndlib.clm.make_granulate.edit_f", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__Pyx_GetModuleGlobalName(__pyx_t_12, __pyx_n_s_EDITCALLBACK); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 4777, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_12);
/* … */
__pyx_tuple__56 = PyTuple_Pack(1, __pyx_n_s_gen); if (unlikely(!__pyx_tuple__56)) __PYX_ERR(0, 4777, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__56);
__Pyx_GIVEREF(__pyx_tuple__56);
__pyx_t_11 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_14make_granulate_3edit_f, 0, __pyx_n_s_make_granulate_locals_edit_f, ((PyObject*)__pyx_cur_scope), __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__57)); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 4777, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_11);
__pyx_t_13 = NULL;
__pyx_t_10 = 0;
#if CYTHON_UNPACK_METHODS
if (unlikely(PyMethod_Check(__pyx_t_12))) {
__pyx_t_13 = PyMethod_GET_SELF(__pyx_t_12);
if (likely(__pyx_t_13)) {
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12);
__Pyx_INCREF(__pyx_t_13);
__Pyx_INCREF(function);
__Pyx_DECREF_SET(__pyx_t_12, function);
__pyx_t_10 = 1;
}
}
#endif
{
PyObject *__pyx_callargs[2] = {__pyx_t_13, __pyx_t_11};
__pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_12, __pyx_callargs+1-__pyx_t_10, 1+__pyx_t_10);
__Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
__Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4777, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
}
__pyx_v_edit_f = __pyx_t_2;
__pyx_t_2 = 0;
__pyx_codeobj__57 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__56, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_edit_f, 4777, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__57)) __PYX_ERR(0, 4777, __pyx_L1_error)
4778: def edit_f(gen):
+4779: return edit(res)
__Pyx_XDECREF(__pyx_r); if (unlikely(!__pyx_cur_scope->__pyx_v_edit)) { __Pyx_RaiseClosureNameError("edit"); __PYX_ERR(0, 4779, __pyx_L1_error) } if (unlikely(!__pyx_cur_scope->__pyx_v_res)) { __Pyx_RaiseClosureNameError("res"); __PYX_ERR(0, 4779, __pyx_L1_error) } __Pyx_INCREF(__pyx_cur_scope->__pyx_v_edit); __pyx_t_2 = __pyx_cur_scope->__pyx_v_edit; __pyx_t_3 = NULL; __pyx_t_4 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_2))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); __pyx_t_4 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_3, ((PyObject *)__pyx_cur_scope->__pyx_v_res)}; __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4779, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
4780:
+4781: cy_edit_f_ptr = (<cclm.edit_cb*><size_t>ctypes.addressof(edit_f))[0]
__Pyx_GetModuleGlobalName(__pyx_t_12, __pyx_n_s_ctypes); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 4781, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_12); __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_addressof); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 4781, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; __pyx_t_12 = NULL; __pyx_t_10 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_11))) { __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_11); if (likely(__pyx_t_12)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11); __Pyx_INCREF(__pyx_t_12); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_11, function); __pyx_t_10 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_12, __pyx_v_edit_f}; __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_11, __pyx_callargs+1-__pyx_t_10, 1+__pyx_t_10); __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4781, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; } __pyx_t_14 = __Pyx_PyInt_As_size_t(__pyx_t_2); if (unlikely((__pyx_t_14 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 4781, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v_cy_edit_f_ptr = (((edit_cb *)((size_t)__pyx_t_14))[0]);
+4782: cclm.mus_granulate_set_edit_function(res._ptr, cy_edit_f_ptr)
mus_granulate_set_edit_function(__pyx_cur_scope->__pyx_v_res->_ptr, __pyx_v_cy_edit_f_ptr);
+4783: res._editcallback = cy_edit_f_ptr
__pyx_cur_scope->__pyx_v_res->_editcallback = __pyx_v_cy_edit_f_ptr;
+4784: res.cache_append(edit_f)
__pyx_t_2 = ((struct __pyx_vtabstruct_8pysndlib_3clm_mus_any *)__pyx_cur_scope->__pyx_v_res->__pyx_vtab)->cache_append(__pyx_cur_scope->__pyx_v_res, __pyx_v_edit_f, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4784, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4785:
+4786: return res
__Pyx_XDECREF(__pyx_r); __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_res); __pyx_r = ((PyObject *)__pyx_cur_scope->__pyx_v_res); goto __pyx_L0;
4787:
4788: #todo: mus_granulate_grain_max_length
+4789: cpdef cython.double granulate(gen: mus_any):
static PyObject *__pyx_pw_8pysndlib_3clm_501granulate(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static double __pyx_f_8pysndlib_3clm_granulate(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, CYTHON_UNUSED int __pyx_skip_dispatch) {
double __pyx_r;
/* … */
/* function exit code */
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_501granulate(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_500granulate, "\n next sample from granular synthesis generator.\n \n :param gen: granulate gen\n :rtype: float\n \n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_501granulate = {"granulate", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_501granulate, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_500granulate};
static PyObject *__pyx_pw_8pysndlib_3clm_501granulate(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("granulate (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gen,0};
PyObject* values[1] = {0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_gen)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4789, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "granulate") < 0)) __PYX_ERR(0, 4789, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 1)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
}
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)values[0]);
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("granulate", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 4789, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.granulate", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gen), __pyx_ptype_8pysndlib_3clm_mus_any, 0, "gen", 0))) __PYX_ERR(0, 4789, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_500granulate(__pyx_self, __pyx_v_gen);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_500granulate(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8pysndlib_3clm_granulate(__pyx_v_gen, 0); if (unlikely(__pyx_t_1 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 4789, __pyx_L1_error)
__pyx_t_2 = PyFloat_FromDouble(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4789, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("pysndlib.clm.granulate", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_43 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 4789, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
if (PyDict_SetItem(__pyx_t_43, __pyx_n_s_gen, __pyx_n_s_mus_any) < 0) __PYX_ERR(0, 4789, __pyx_L1_error)
__pyx_t_37 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_501granulate, 0, __pyx_n_s_granulate, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__555)); if (unlikely(!__pyx_t_37)) __PYX_ERR(0, 4789, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_37);
__Pyx_CyFunction_SetAnnotationsDict(__pyx_t_37, __pyx_t_43);
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
if (PyDict_SetItem(__pyx_d, __pyx_n_s_granulate, __pyx_t_37) < 0) __PYX_ERR(0, 4789, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_37); __pyx_t_37 = 0;
/* … */
__pyx_codeobj__555 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__56, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_granulate, 4789, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__555)) __PYX_ERR(0, 4789, __pyx_L1_error)
4790: """
4791: next sample from granular synthesis generator.
4792:
4793: :param gen: granulate gen
4794: :rtype: float
4795:
4796: """
+4797: if gen._editcallback is not NULL:
__pyx_t_1 = (__pyx_v_gen->_editcallback != NULL);
if (__pyx_t_1) {
/* … */
}
+4798: return cclm.mus_granulate_with_editor(gen._ptr, <cclm.input_cb>gen._inputcallback, <cclm.edit_cb>gen._editcallback)
__pyx_r = mus_granulate_with_editor(__pyx_v_gen->_ptr, ((input_cb)__pyx_v_gen->_inputcallback), ((edit_cb)__pyx_v_gen->_editcallback));
goto __pyx_L0;
4799: else:
+4800: return cclm.mus_granulate(gen._ptr, <cclm.input_cb>gen._inputcallback)
/*else*/ {
__pyx_r = mus_granulate(__pyx_v_gen->_ptr, ((input_cb)__pyx_v_gen->_inputcallback));
goto __pyx_L0;
}
4801:
4802:
+4803: cpdef bint is_granulate(e: mus_any):
static PyObject *__pyx_pw_8pysndlib_3clm_503is_granulate(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static int __pyx_f_8pysndlib_3clm_is_granulate(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_e, CYTHON_UNUSED int __pyx_skip_dispatch) {
int __pyx_r;
/* … */
/* function exit code */
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_503is_granulate(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_502is_granulate, "\n returns True if gen is a granulate.\n \n :param gen: gen\n :rtype: bool\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_503is_granulate = {"is_granulate", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_503is_granulate, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_502is_granulate};
static PyObject *__pyx_pw_8pysndlib_3clm_503is_granulate(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_e = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("is_granulate (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_e,0};
PyObject* values[1] = {0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_e)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4803, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "is_granulate") < 0)) __PYX_ERR(0, 4803, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 1)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
}
__pyx_v_e = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)values[0]);
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("is_granulate", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 4803, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.is_granulate", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_e), __pyx_ptype_8pysndlib_3clm_mus_any, 0, "e", 0))) __PYX_ERR(0, 4803, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_502is_granulate(__pyx_self, __pyx_v_e);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_502is_granulate(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_e) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8pysndlib_3clm_is_granulate(__pyx_v_e, 0); if (unlikely(__pyx_t_1 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 4803, __pyx_L1_error)
__pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4803, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("pysndlib.clm.is_granulate", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_tuple__556 = PyTuple_Pack(1, __pyx_n_s_e); if (unlikely(!__pyx_tuple__556)) __PYX_ERR(0, 4803, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__556);
__Pyx_GIVEREF(__pyx_tuple__556);
/* … */
__pyx_t_37 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_37)) __PYX_ERR(0, 4803, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_37);
if (PyDict_SetItem(__pyx_t_37, __pyx_n_s_e, __pyx_n_s_mus_any) < 0) __PYX_ERR(0, 4803, __pyx_L1_error)
__pyx_t_43 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_503is_granulate, 0, __pyx_n_s_is_granulate, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__557)); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 4803, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
__Pyx_CyFunction_SetAnnotationsDict(__pyx_t_43, __pyx_t_37);
__Pyx_DECREF(__pyx_t_37); __pyx_t_37 = 0;
if (PyDict_SetItem(__pyx_d, __pyx_n_s_is_granulate, __pyx_t_43) < 0) __PYX_ERR(0, 4803, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
__pyx_codeobj__557 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__556, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_is_granulate, 4803, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__557)) __PYX_ERR(0, 4803, __pyx_L1_error)
4804: """
4805: returns True if gen is a granulate.
4806:
4807: :param gen: gen
4808: :rtype: bool
4809: """
+4810: return cclm.mus_is_granulate(e._ptr)
__pyx_r = mus_is_granulate(__pyx_v_e->_ptr); goto __pyx_L0;
4811:
4812: #--------------- phase-vocoder ----------------#
+4813: def make_phase_vocoder(inp,
/* Python wrapper */ static PyObject *__pyx_pw_8pysndlib_3clm_505make_phase_vocoder(PyObject *__pyx_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_504make_phase_vocoder, "\n return a new phase-vocoder generator; input is the input function (it can be set at run-time),\n analyze, edit, and synthesize are either None or functions that replace the default innards of the\n generator, fft_size, overlap and interp set the fft_size, the amount of overlap between ffts, and the\n time between new analysis calls. 'analyze', if given, takes 2 args, the generator and the input\n function; if it returns True, the default analysis code is also called. 'edit', if given, takes 1 arg,\n the generator; if it returns True, the default edit code is run. 'synthesize' is a function of 1 arg,\n the generator; it is called to get the current vocoder output.\n \n :param inp: gen or function to read from. if a callback, the function takes 1 input, the direction and should return read value\n :param fft_size: fft size used\n :param overlap: how many analysis stages overlap\n :param interp: samples between fft\n :param pitch: pitch scaling ratio\n :param analyze: if used, overrides default. should be a function of two arguments, the generator and the input function. \n :param edit: if used, overrides default. functions of one argument, the phase_vocoder mus_any. change amplitudes and phases\n :param synthesize: if used, overrides default. unctions of one argument, the phase_vocoder mus_any.\n :return: phase_vocoder gen\n \n "); static PyMethodDef __pyx_mdef_8pysndlib_3clm_505make_phase_vocoder = {"make_phase_vocoder", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_505make_phase_vocoder, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_504make_phase_vocoder}; static PyObject *__pyx_pw_8pysndlib_3clm_505make_phase_vocoder(PyObject *__pyx_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { PyObject *__pyx_v_inp = 0; PyObject *__pyx_v_fft_size = 0; PyObject *__pyx_v_overlap = 0; PyObject *__pyx_v_interp = 0; PyObject *__pyx_v_pitch = 0; PyObject *__pyx_v_analyze = 0; PyObject *__pyx_v_edit = 0; PyObject *__pyx_v_synthesize = 0; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("make_phase_vocoder (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_MACROS __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { PyObject **__pyx_pyargnames[] = {&__pyx_n_s_inp,&__pyx_n_s_fft_size,&__pyx_n_s_overlap,&__pyx_n_s_interp,&__pyx_n_s_pitch,&__pyx_n_s_analyze,&__pyx_n_s_edit,&__pyx_n_s_synthesize,0}; PyObject* values[8] = {0,0,0,0,0,0,0,0}; values[1] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)((PyObject *)__pyx_int_512))); values[2] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)((PyObject *)__pyx_int_4))); values[3] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)((PyObject *)__pyx_int_128))); values[4] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)((PyObject*)__pyx_float_1_0))); /* … */ /* function exit code */ { Py_ssize_t __pyx_temp; for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); } } __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ static PyObject *__pyx_pf_8pysndlib_3clm_504make_phase_vocoder(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_inp, PyObject *__pyx_v_fft_size, PyObject *__pyx_v_overlap, PyObject *__pyx_v_interp, PyObject *__pyx_v_pitch, PyObject *__pyx_v_analyze, PyObject *__pyx_v_edit, PyObject *__pyx_v_synthesize) { struct __pyx_obj_8pysndlib_3clm___pyx_scope_struct_4_make_phase_vocoder *__pyx_cur_scope; input_cb __pyx_v_cy_inp_f_ptr; edit_cb __pyx_v_cy_edit_f_ptr; analyze_cb __pyx_v_cy_analyze_f_ptr; synthesize_cb __pyx_v_cy_synthesize_f_ptr; PyObject *__pyx_v_inp_f = 0; PyObject *__pyx_v_edit_f = 0; PyObject *__pyx_v_analyze_f = 0; PyObject *__pyx_v_synthesize_f = 0; PyObject *__pyx_r = NULL; __pyx_cur_scope = (struct __pyx_obj_8pysndlib_3clm___pyx_scope_struct_4_make_phase_vocoder *)__pyx_tp_new_8pysndlib_3clm___pyx_scope_struct_4_make_phase_vocoder(__pyx_ptype_8pysndlib_3clm___pyx_scope_struct_4_make_phase_vocoder, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_cur_scope)) { __pyx_cur_scope = ((struct __pyx_obj_8pysndlib_3clm___pyx_scope_struct_4_make_phase_vocoder *)Py_None); __Pyx_INCREF(Py_None); __PYX_ERR(0, 4813, __pyx_L1_error) } else { __Pyx_GOTREF((PyObject *)__pyx_cur_scope); } __pyx_cur_scope->__pyx_v_inp = __pyx_v_inp; __Pyx_INCREF(__pyx_cur_scope->__pyx_v_inp); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_inp); __pyx_cur_scope->__pyx_v_analyze = __pyx_v_analyze; __Pyx_INCREF(__pyx_cur_scope->__pyx_v_analyze); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_analyze); __pyx_cur_scope->__pyx_v_edit = __pyx_v_edit; __Pyx_INCREF(__pyx_cur_scope->__pyx_v_edit); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_edit); __pyx_cur_scope->__pyx_v_synthesize = __pyx_v_synthesize; __Pyx_INCREF(__pyx_cur_scope->__pyx_v_synthesize); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_synthesize); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_11); __Pyx_XDECREF(__pyx_t_12); __Pyx_AddTraceback("pysndlib.clm.make_phase_vocoder", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_inp_f); __Pyx_XDECREF(__pyx_v_edit_f); __Pyx_XDECREF(__pyx_v_analyze_f); __Pyx_XDECREF(__pyx_v_synthesize_f); __Pyx_DECREF((PyObject *)__pyx_cur_scope); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__558 = PyTuple_Pack(21, __pyx_n_s_inp, __pyx_n_s_fft_size, __pyx_n_s_overlap, __pyx_n_s_interp, __pyx_n_s_pitch, __pyx_n_s_analyze, __pyx_n_s_edit, __pyx_n_s_synthesize, __pyx_n_s_cy_inp_f_ptr, __pyx_n_s_cy_edit_f_ptr, __pyx_n_s_cy_analyze_f_ptr, __pyx_n_s_cy_synthesize_f_ptr, __pyx_n_s_res, __pyx_n_s_inp_f, __pyx_n_s_inp_f, __pyx_n_s_edit_f, __pyx_n_s_edit_f, __pyx_n_s_analyze_f, __pyx_n_s_analyze_f, __pyx_n_s_synthesize_f, __pyx_n_s_synthesize_f); if (unlikely(!__pyx_tuple__558)) __PYX_ERR(0, 4813, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__558); __Pyx_GIVEREF(__pyx_tuple__558); __pyx_codeobj__559 = (PyObject*)__Pyx_PyCode_New(8, 0, 0, 21, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__558, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_make_phase_vocoder, 4813, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__559)) __PYX_ERR(0, 4813, __pyx_L1_error) /* … */ __pyx_t_43 = __Pyx_PyDict_NewPresized(4); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 4813, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_43); if (PyDict_SetItem(__pyx_t_43, __pyx_n_s_fft_size, __pyx_kp_s_Optional_int) < 0) __PYX_ERR(0, 4813, __pyx_L1_error) if (PyDict_SetItem(__pyx_t_43, __pyx_n_s_overlap, __pyx_kp_s_Optional_int) < 0) __PYX_ERR(0, 4813, __pyx_L1_error) if (PyDict_SetItem(__pyx_t_43, __pyx_n_s_interp, __pyx_kp_s_Optional_int) < 0) __PYX_ERR(0, 4813, __pyx_L1_error) if (PyDict_SetItem(__pyx_t_43, __pyx_n_s_pitch, __pyx_kp_s_Optional_float) < 0) __PYX_ERR(0, 4813, __pyx_L1_error) __pyx_t_37 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_505make_phase_vocoder, 0, __pyx_n_s_make_phase_vocoder, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__559)); if (unlikely(!__pyx_t_37)) __PYX_ERR(0, 4813, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_37); __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_37, __pyx_tuple__560); __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_37, __pyx_t_43); __Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0; if (PyDict_SetItem(__pyx_d, __pyx_n_s_make_phase_vocoder, __pyx_t_37) < 0) __PYX_ERR(0, 4813, __pyx_L1_error) __Pyx_DECREF(__pyx_t_37); __pyx_t_37 = 0; __pyx_tuple__560 = PyTuple_Pack(7, ((PyObject *)__pyx_int_512), ((PyObject *)__pyx_int_4), ((PyObject *)__pyx_int_128), ((PyObject*)__pyx_float_1_0), Py_None, Py_None, Py_None); if (unlikely(!__pyx_tuple__560)) __PYX_ERR(0, 4813, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__560); __Pyx_GIVEREF(__pyx_tuple__560); /* … */ struct __pyx_obj_8pysndlib_3clm___pyx_scope_struct_4_make_phase_vocoder { PyObject_HEAD PyObject *__pyx_v_analyze; PyObject *__pyx_v_edit; PyObject *__pyx_v_inp; struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_res; PyObject *__pyx_v_synthesize; };
4814: fft_size: Optional[int]=512,
4815: overlap: Optional[int]=4,
4816: interp: Optional[int]=128,
4817: pitch: Optional[float]=1.0,
+4818: analyze=None,
values[5] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
+4819: edit=None,
values[6] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
+4820: synthesize=None):
values[7] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None)); if (__pyx_kwds) { Py_ssize_t kw_args; switch (__pyx_nargs) { case 8: values[7] = __Pyx_Arg_FASTCALL(__pyx_args, 7); CYTHON_FALLTHROUGH; case 7: values[6] = __Pyx_Arg_FASTCALL(__pyx_args, 6); CYTHON_FALLTHROUGH; case 6: values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); CYTHON_FALLTHROUGH; case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); CYTHON_FALLTHROUGH; case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); CYTHON_FALLTHROUGH; case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); CYTHON_FALLTHROUGH; case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); CYTHON_FALLTHROUGH; case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); switch (__pyx_nargs) { case 0: if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_inp)) != 0)) { (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); kw_args--; } else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4813, __pyx_L3_error) else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: if (kw_args > 0) { PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_fft_size); if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4813, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: if (kw_args > 0) { PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_overlap); if (value) { values[2] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4813, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 3: if (kw_args > 0) { PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_interp); if (value) { values[3] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4813, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 4: if (kw_args > 0) { PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pitch); if (value) { values[4] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4813, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 5: if (kw_args > 0) { PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_analyze); if (value) { values[5] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4813, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 6: if (kw_args > 0) { PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_edit); if (value) { values[6] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4813, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 7: if (kw_args > 0) { PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_synthesize); if (value) { values[7] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4813, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { const Py_ssize_t kwd_pos_args = __pyx_nargs; if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "make_phase_vocoder") < 0)) __PYX_ERR(0, 4813, __pyx_L3_error) } } else { switch (__pyx_nargs) { case 8: values[7] = __Pyx_Arg_FASTCALL(__pyx_args, 7); CYTHON_FALLTHROUGH; case 7: values[6] = __Pyx_Arg_FASTCALL(__pyx_args, 6); CYTHON_FALLTHROUGH; case 6: values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5); CYTHON_FALLTHROUGH; case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); CYTHON_FALLTHROUGH; case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); CYTHON_FALLTHROUGH; case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); CYTHON_FALLTHROUGH; case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); CYTHON_FALLTHROUGH; case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); break; default: goto __pyx_L5_argtuple_error; } } __pyx_v_inp = values[0]; __pyx_v_fft_size = values[1]; __pyx_v_overlap = values[2]; __pyx_v_interp = values[3]; __pyx_v_pitch = values[4]; __pyx_v_analyze = values[5]; __pyx_v_edit = values[6]; __pyx_v_synthesize = values[7]; } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("make_phase_vocoder", 0, 1, 8, __pyx_nargs); __PYX_ERR(0, 4813, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; { Py_ssize_t __pyx_temp; for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); } } __Pyx_AddTraceback("pysndlib.clm.make_phase_vocoder", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_8pysndlib_3clm_504make_phase_vocoder(__pyx_self, __pyx_v_inp, __pyx_v_fft_size, __pyx_v_overlap, __pyx_v_interp, __pyx_v_pitch, __pyx_v_analyze, __pyx_v_edit, __pyx_v_synthesize);
4821:
4822: """
4823: return a new phase-vocoder generator; input is the input function (it can be set at run-time),
4824: analyze, edit, and synthesize are either None or functions that replace the default innards of the
4825: generator, fft_size, overlap and interp set the fft_size, the amount of overlap between ffts, and the
4826: time between new analysis calls. 'analyze', if given, takes 2 args, the generator and the input
4827: function; if it returns True, the default analysis code is also called. 'edit', if given, takes 1 arg,
4828: the generator; if it returns True, the default edit code is run. 'synthesize' is a function of 1 arg,
4829: the generator; it is called to get the current vocoder output.
4830:
4831: :param inp: gen or function to read from. if a callback, the function takes 1 input, the direction and should return read value
4832: :param fft_size: fft size used
4833: :param overlap: how many analysis stages overlap
4834: :param interp: samples between fft
4835: :param pitch: pitch scaling ratio
4836: :param analyze: if used, overrides default. should be a function of two arguments, the generator and the input function.
4837: :param edit: if used, overrides default. functions of one argument, the phase_vocoder mus_any. change amplitudes and phases
4838: :param synthesize: if used, overrides default. unctions of one argument, the phase_vocoder mus_any.
4839: :return: phase_vocoder gen
4840:
4841: """
4842:
4843: cdef cclm.input_cb cy_inp_f_ptr
4844: cdef cclm.edit_cb cy_edit_f_ptr
4845: cdef cclm.analyze_cb cy_analyze_f_ptr
4846: cdef cclm.synthesize_cb cy_synthesize_f_ptr
4847:
+4848: if fft_size <= 1:
__pyx_t_1 = PyObject_RichCompare(__pyx_v_fft_size, __pyx_int_1, Py_LE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4848, __pyx_L1_error) __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 4848, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (unlikely(__pyx_t_2)) { /* … */ }
+4849: raise ValueError(f'fft_size must be a positive number greater than 1 not {fft_size}')
__pyx_t_1 = __Pyx_PyObject_FormatSimple(__pyx_v_fft_size, __pyx_empty_unicode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4849, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = __Pyx_PyUnicode_Concat(__pyx_kp_u_fft_size_must_be_a_positive_numb_2, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4849, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4849, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __PYX_ERR(0, 4849, __pyx_L1_error)
4850:
+4851: if fft_size > csndlib.mus_max_malloc():
__pyx_t_1 = __Pyx_PyInt_From_int64_t(mus_max_malloc()); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4851, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = PyObject_RichCompare(__pyx_v_fft_size, __pyx_t_1, Py_GT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4851, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 4851, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(__pyx_t_2)) { /* … */ }
+4852: raise ValueError(f'fft_size too large. cannot allocate {fft_size} size fft')
__pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4852, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = 0; __pyx_t_5 = 127; __Pyx_INCREF(__pyx_kp_u_fft_size_too_large_cannot_alloca); __pyx_t_4 += 36; __Pyx_GIVEREF(__pyx_kp_u_fft_size_too_large_cannot_alloca); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_kp_u_fft_size_too_large_cannot_alloca); __pyx_t_1 = __Pyx_PyObject_FormatSimple(__pyx_v_fft_size, __pyx_empty_unicode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4852, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_5 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_1) > __pyx_t_5) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_1) : __pyx_t_5; __pyx_t_4 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1); __pyx_t_1 = 0; __Pyx_INCREF(__pyx_kp_u_size_fft); __pyx_t_4 += 9; __Pyx_GIVEREF(__pyx_kp_u_size_fft); PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_kp_u_size_fft); __pyx_t_1 = __Pyx_PyUnicode_Join(__pyx_t_3, 3, __pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4852, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4852, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __PYX_ERR(0, 4852, __pyx_L1_error)
4853:
+4854: if not is_power_of_2(fft_size):
__pyx_t_3 = __pyx_f_8pysndlib_3clm_is_power_of_2(__pyx_v_fft_size, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4854, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 4854, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_6 = (!__pyx_t_2); if (unlikely(__pyx_t_6)) { /* … */ }
+4855: raise ValueError(f'fft_size must be power of 2 not {fft_size}')
__pyx_t_3 = __Pyx_PyObject_FormatSimple(__pyx_v_fft_size, __pyx_empty_unicode); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4855, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_1 = __Pyx_PyUnicode_Concat(__pyx_kp_u_fft_size_must_be_power_of_2_not, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4855, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4855, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __PYX_ERR(0, 4855, __pyx_L1_error)
4856:
+4857: if(isinstance(inp, mus_any)):
__pyx_t_3 = __pyx_cur_scope->__pyx_v_inp; __Pyx_INCREF(__pyx_t_3); __pyx_t_6 = __Pyx_TypeCheck(__pyx_t_3, __pyx_ptype_8pysndlib_3clm_mus_any); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_6) { /* … */ goto __pyx_L6; }
+4858: res = mus_any.from_ptr(cclm.mus_make_phase_vocoder(<cclm.input_cb>input_callback_func, fft_size, overlap, interp, pitch, NULL, NULL, NULL, <void*>(<mus_any>inp)._ptr))
__pyx_t_7 = __Pyx_PyInt_As_int(__pyx_v_fft_size); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 4858, __pyx_L1_error) __pyx_t_8 = __Pyx_PyInt_As_int(__pyx_v_overlap); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 4858, __pyx_L1_error) __pyx_t_9 = __Pyx_PyInt_As_int(__pyx_v_interp); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 4858, __pyx_L1_error) __pyx_t_10 = __pyx_PyFloat_AsDouble(__pyx_v_pitch); if (unlikely((__pyx_t_10 == ((mus_float_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 4858, __pyx_L1_error) __pyx_t_3 = ((PyObject *)__pyx_vtabptr_8pysndlib_3clm_mus_any->from_ptr(mus_make_phase_vocoder(((input_cb)__pyx_f_8pysndlib_3clm_input_callback_func), __pyx_t_7, __pyx_t_8, __pyx_t_9, __pyx_t_10, NULL, NULL, NULL, ((void *)((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_cur_scope->__pyx_v_inp)->_ptr)), NULL)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4858, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_cur_scope->__pyx_v_res = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_t_3); __pyx_t_3 = 0;
+4859: res._inputcallback = <cclm.input_cb>input_callback_func
__pyx_cur_scope->__pyx_v_res->_inputcallback = ((input_cb)__pyx_f_8pysndlib_3clm_input_callback_func);
+4860: res.cache_append(inp)
__pyx_t_3 = __pyx_cur_scope->__pyx_v_inp;
__Pyx_INCREF(__pyx_t_3);
__pyx_t_1 = ((struct __pyx_vtabstruct_8pysndlib_3clm_mus_any *)__pyx_cur_scope->__pyx_v_res->__pyx_vtab)->cache_append(__pyx_cur_scope->__pyx_v_res, __pyx_t_3, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4860, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+4861: elif callable(inp):
__pyx_t_1 = __pyx_cur_scope->__pyx_v_inp; __Pyx_INCREF(__pyx_t_1); __pyx_t_6 = __Pyx_PyCallable_Check(__pyx_t_1); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(0, 4861, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (likely(__pyx_t_6)) { /* … */ goto __pyx_L6; }
+4862: @INPUTCALLBACK
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_18make_phase_vocoder_1inp_f(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_8pysndlib_3clm_18make_phase_vocoder_1inp_f = {"inp_f", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_18make_phase_vocoder_1inp_f, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_8pysndlib_3clm_18make_phase_vocoder_1inp_f(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
CYTHON_UNUSED PyObject *__pyx_v_gen = 0;
PyObject *__pyx_v_d = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("inp_f (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gen,&__pyx_n_s_d,0};
PyObject* values[2] = {0,0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_gen)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4862, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_d)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4862, __pyx_L3_error)
else {
__Pyx_RaiseArgtupleInvalid("inp_f", 1, 2, 2, 1); __PYX_ERR(0, 4862, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "inp_f") < 0)) __PYX_ERR(0, 4862, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 2)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
}
__pyx_v_gen = values[0];
__pyx_v_d = values[1];
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("inp_f", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 4862, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.make_phase_vocoder.inp_f", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_8pysndlib_3clm_18make_phase_vocoder_inp_f(__pyx_self, __pyx_v_gen, __pyx_v_d);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_18make_phase_vocoder_inp_f(PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_gen, PyObject *__pyx_v_d) {
struct __pyx_obj_8pysndlib_3clm___pyx_scope_struct_4_make_phase_vocoder *__pyx_cur_scope;
struct __pyx_obj_8pysndlib_3clm___pyx_scope_struct_4_make_phase_vocoder *__pyx_outer_scope;
PyObject *__pyx_r = NULL;
__pyx_outer_scope = (struct __pyx_obj_8pysndlib_3clm___pyx_scope_struct_4_make_phase_vocoder *) __Pyx_CyFunction_GetClosure(__pyx_self);
__pyx_cur_scope = __pyx_outer_scope;
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_AddTraceback("pysndlib.clm.make_phase_vocoder.inp_f", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_INPUTCALLBACK); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4862, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_11 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_18make_phase_vocoder_1inp_f, 0, __pyx_n_s_make_phase_vocoder_locals_inp_f, ((PyObject*)__pyx_cur_scope), __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__58)); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 4862, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_11);
__pyx_t_12 = NULL;
__pyx_t_9 = 0;
#if CYTHON_UNPACK_METHODS
if (unlikely(PyMethod_Check(__pyx_t_3))) {
__pyx_t_12 = PyMethod_GET_SELF(__pyx_t_3);
if (likely(__pyx_t_12)) {
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
__Pyx_INCREF(__pyx_t_12);
__Pyx_INCREF(function);
__Pyx_DECREF_SET(__pyx_t_3, function);
__pyx_t_9 = 1;
}
}
#endif
{
PyObject *__pyx_callargs[2] = {__pyx_t_12, __pyx_t_11};
__pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_9, 1+__pyx_t_9);
__Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
__Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4862, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
}
__pyx_v_inp_f = __pyx_t_1;
__pyx_t_1 = 0;
/* … */
__pyx_codeobj__58 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__52, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_inp_f, 4862, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__58)) __PYX_ERR(0, 4862, __pyx_L1_error)
4863: def inp_f(gen, d):
+4864: return inp(d)
__Pyx_XDECREF(__pyx_r); if (unlikely(!__pyx_cur_scope->__pyx_v_inp)) { __Pyx_RaiseClosureNameError("inp"); __PYX_ERR(0, 4864, __pyx_L1_error) } __Pyx_INCREF(__pyx_cur_scope->__pyx_v_inp); __pyx_t_2 = __pyx_cur_scope->__pyx_v_inp; __pyx_t_3 = NULL; __pyx_t_4 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_2))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); __pyx_t_4 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v_d}; __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4864, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
+4865: cy_inp_f_ptr = (<cclm.input_cb*><size_t>ctypes.addressof(inp_f))[0]
__Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_ctypes); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4865, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_addressof); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 4865, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = NULL; __pyx_t_9 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_11))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_11); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_11, function); __pyx_t_9 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v_inp_f}; __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_11, __pyx_callargs+1-__pyx_t_9, 1+__pyx_t_9); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4865, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; } __pyx_t_13 = __Pyx_PyInt_As_size_t(__pyx_t_1); if (unlikely((__pyx_t_13 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 4865, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_cy_inp_f_ptr = (((input_cb *)((size_t)__pyx_t_13))[0]);
+4866: res = mus_any.from_ptr(cclm.mus_make_phase_vocoder(cy_inp_f_ptr, fft_size, overlap, interp, pitch, NULL, NULL, NULL, NULL))
__pyx_t_9 = __Pyx_PyInt_As_int(__pyx_v_fft_size); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 4866, __pyx_L1_error) __pyx_t_8 = __Pyx_PyInt_As_int(__pyx_v_overlap); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 4866, __pyx_L1_error) __pyx_t_7 = __Pyx_PyInt_As_int(__pyx_v_interp); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 4866, __pyx_L1_error) __pyx_t_10 = __pyx_PyFloat_AsDouble(__pyx_v_pitch); if (unlikely((__pyx_t_10 == ((mus_float_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 4866, __pyx_L1_error) __pyx_t_1 = ((PyObject *)__pyx_vtabptr_8pysndlib_3clm_mus_any->from_ptr(mus_make_phase_vocoder(__pyx_v_cy_inp_f_ptr, __pyx_t_9, __pyx_t_8, __pyx_t_7, __pyx_t_10, NULL, NULL, NULL, NULL), NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4866, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_cur_scope->__pyx_v_res = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_t_1); __pyx_t_1 = 0;
+4867: res._inputcallback = cy_inp_f_ptr
__pyx_cur_scope->__pyx_v_res->_inputcallback = __pyx_v_cy_inp_f_ptr;
+4868: res.cache_append(inp_f)
__pyx_t_1 = ((struct __pyx_vtabstruct_8pysndlib_3clm_mus_any *)__pyx_cur_scope->__pyx_v_res->__pyx_vtab)->cache_append(__pyx_cur_scope->__pyx_v_res, __pyx_v_inp_f, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4868, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4869:
4870: else:
+4871: raise TypeError(f"input needs to be a clm gen or a callable not a {type(inp)}")
/*else*/ {
__pyx_t_1 = __Pyx_PyObject_FormatSimple(((PyObject *)Py_TYPE(__pyx_cur_scope->__pyx_v_inp)), __pyx_empty_unicode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4871, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_11 = __Pyx_PyUnicode_Concat(__pyx_kp_u_input_needs_to_be_a_clm_gen_or_a, __pyx_t_1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 4871, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_11);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_11); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4871, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
__Pyx_Raise(__pyx_t_1, 0, 0, 0);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__PYX_ERR(0, 4871, __pyx_L1_error)
}
__pyx_L6:;
4872:
+4873: if(edit is not None):
__pyx_t_6 = (__pyx_cur_scope->__pyx_v_edit != Py_None);
if (__pyx_t_6) {
/* … */
}
+4874: @EDITCALLBACK
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_18make_phase_vocoder_3edit_f(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_8pysndlib_3clm_18make_phase_vocoder_3edit_f = {"edit_f", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_18make_phase_vocoder_3edit_f, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_8pysndlib_3clm_18make_phase_vocoder_3edit_f(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
CYTHON_UNUSED PyObject *__pyx_v_gen = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("edit_f (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gen,0};
PyObject* values[1] = {0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_gen)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4874, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "edit_f") < 0)) __PYX_ERR(0, 4874, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 1)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
}
__pyx_v_gen = values[0];
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("edit_f", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 4874, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.make_phase_vocoder.edit_f", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_8pysndlib_3clm_18make_phase_vocoder_2edit_f(__pyx_self, __pyx_v_gen);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_18make_phase_vocoder_2edit_f(PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_gen) {
struct __pyx_obj_8pysndlib_3clm___pyx_scope_struct_4_make_phase_vocoder *__pyx_cur_scope;
struct __pyx_obj_8pysndlib_3clm___pyx_scope_struct_4_make_phase_vocoder *__pyx_outer_scope;
PyObject *__pyx_r = NULL;
__pyx_outer_scope = (struct __pyx_obj_8pysndlib_3clm___pyx_scope_struct_4_make_phase_vocoder *) __Pyx_CyFunction_GetClosure(__pyx_self);
__pyx_cur_scope = __pyx_outer_scope;
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_AddTraceback("pysndlib.clm.make_phase_vocoder.edit_f", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_EDITCALLBACK); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 4874, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_11);
__pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_18make_phase_vocoder_3edit_f, 0, __pyx_n_s_make_phase_vocoder_locals_edit_f, ((PyObject*)__pyx_cur_scope), __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__59)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4874, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_12 = NULL;
__pyx_t_7 = 0;
#if CYTHON_UNPACK_METHODS
if (unlikely(PyMethod_Check(__pyx_t_11))) {
__pyx_t_12 = PyMethod_GET_SELF(__pyx_t_11);
if (likely(__pyx_t_12)) {
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11);
__Pyx_INCREF(__pyx_t_12);
__Pyx_INCREF(function);
__Pyx_DECREF_SET(__pyx_t_11, function);
__pyx_t_7 = 1;
}
}
#endif
{
PyObject *__pyx_callargs[2] = {__pyx_t_12, __pyx_t_3};
__pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_11, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7);
__Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4874, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
}
__pyx_v_edit_f = __pyx_t_1;
__pyx_t_1 = 0;
/* … */
__pyx_codeobj__59 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__56, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_edit_f, 4874, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__59)) __PYX_ERR(0, 4874, __pyx_L1_error)
4875: def edit_f(gen):
+4876: return edit(res)
__Pyx_XDECREF(__pyx_r); if (unlikely(!__pyx_cur_scope->__pyx_v_edit)) { __Pyx_RaiseClosureNameError("edit"); __PYX_ERR(0, 4876, __pyx_L1_error) } if (unlikely(!__pyx_cur_scope->__pyx_v_res)) { __Pyx_RaiseClosureNameError("res"); __PYX_ERR(0, 4876, __pyx_L1_error) } __Pyx_INCREF(__pyx_cur_scope->__pyx_v_edit); __pyx_t_2 = __pyx_cur_scope->__pyx_v_edit; __pyx_t_3 = NULL; __pyx_t_4 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_2))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); __pyx_t_4 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_3, ((PyObject *)__pyx_cur_scope->__pyx_v_res)}; __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4876, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
+4877: cy_edit_f_ptr = (<cclm.edit_cb*><size_t>ctypes.addressof(edit_f))[0]
__Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_ctypes); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 4877, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_addressof); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4877, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; __pyx_t_11 = NULL; __pyx_t_7 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_3))) { __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_11)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_11); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); __pyx_t_7 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_11, __pyx_v_edit_f}; __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7); __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4877, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } __pyx_t_13 = __Pyx_PyInt_As_size_t(__pyx_t_1); if (unlikely((__pyx_t_13 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 4877, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_cy_edit_f_ptr = (((edit_cb *)((size_t)__pyx_t_13))[0]);
+4878: res._editcallback = cy_edit_f_ptr
__pyx_cur_scope->__pyx_v_res->_editcallback = __pyx_v_cy_edit_f_ptr;
+4879: res.cache_append(edit_f)
__pyx_t_1 = ((struct __pyx_vtabstruct_8pysndlib_3clm_mus_any *)__pyx_cur_scope->__pyx_v_res->__pyx_vtab)->cache_append(__pyx_cur_scope->__pyx_v_res, __pyx_v_edit_f, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4879, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4880:
+4881: if (analyze is not None):
__pyx_t_6 = (__pyx_cur_scope->__pyx_v_analyze != Py_None);
if (__pyx_t_6) {
/* … */
}
+4882: @ANALYZECALLBACK
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_18make_phase_vocoder_5analyze_f(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_8pysndlib_3clm_18make_phase_vocoder_5analyze_f = {"analyze_f", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_18make_phase_vocoder_5analyze_f, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_8pysndlib_3clm_18make_phase_vocoder_5analyze_f(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
CYTHON_UNUSED PyObject *__pyx_v_gen = 0;
CYTHON_UNUSED PyObject *__pyx_v_func = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("analyze_f (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gen,&__pyx_n_s_func,0};
PyObject* values[2] = {0,0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_gen)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4882, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_func)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4882, __pyx_L3_error)
else {
__Pyx_RaiseArgtupleInvalid("analyze_f", 1, 2, 2, 1); __PYX_ERR(0, 4882, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "analyze_f") < 0)) __PYX_ERR(0, 4882, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 2)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
}
__pyx_v_gen = values[0];
__pyx_v_func = values[1];
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("analyze_f", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 4882, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.make_phase_vocoder.analyze_f", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_8pysndlib_3clm_18make_phase_vocoder_4analyze_f(__pyx_self, __pyx_v_gen, __pyx_v_func);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_18make_phase_vocoder_4analyze_f(PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_gen, CYTHON_UNUSED PyObject *__pyx_v_func) {
struct __pyx_obj_8pysndlib_3clm___pyx_scope_struct_4_make_phase_vocoder *__pyx_cur_scope;
struct __pyx_obj_8pysndlib_3clm___pyx_scope_struct_4_make_phase_vocoder *__pyx_outer_scope;
PyObject *__pyx_r = NULL;
__pyx_outer_scope = (struct __pyx_obj_8pysndlib_3clm___pyx_scope_struct_4_make_phase_vocoder *) __Pyx_CyFunction_GetClosure(__pyx_self);
__pyx_cur_scope = __pyx_outer_scope;
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_AddTraceback("pysndlib.clm.make_phase_vocoder.analyze_f", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_ANALYZECALLBACK); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4882, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
/* … */
__pyx_tuple__60 = PyTuple_Pack(2, __pyx_n_s_gen, __pyx_n_s_func); if (unlikely(!__pyx_tuple__60)) __PYX_ERR(0, 4882, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__60);
__Pyx_GIVEREF(__pyx_tuple__60);
__pyx_t_11 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_18make_phase_vocoder_5analyze_f, 0, __pyx_n_s_make_phase_vocoder_locals_analyz, ((PyObject*)__pyx_cur_scope), __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__61)); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 4882, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_11);
__pyx_t_12 = NULL;
__pyx_t_7 = 0;
#if CYTHON_UNPACK_METHODS
if (unlikely(PyMethod_Check(__pyx_t_3))) {
__pyx_t_12 = PyMethod_GET_SELF(__pyx_t_3);
if (likely(__pyx_t_12)) {
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
__Pyx_INCREF(__pyx_t_12);
__Pyx_INCREF(function);
__Pyx_DECREF_SET(__pyx_t_3, function);
__pyx_t_7 = 1;
}
}
#endif
{
PyObject *__pyx_callargs[2] = {__pyx_t_12, __pyx_t_11};
__pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7);
__Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
__Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4882, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
}
__pyx_v_analyze_f = __pyx_t_1;
__pyx_t_1 = 0;
__pyx_codeobj__61 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__60, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_analyze_f, 4882, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__61)) __PYX_ERR(0, 4882, __pyx_L1_error)
4883: def analyze_f(gen, func):
+4884: return analyze(res, inp)
__Pyx_XDECREF(__pyx_r); if (unlikely(!__pyx_cur_scope->__pyx_v_analyze)) { __Pyx_RaiseClosureNameError("analyze"); __PYX_ERR(0, 4884, __pyx_L1_error) } if (unlikely(!__pyx_cur_scope->__pyx_v_res)) { __Pyx_RaiseClosureNameError("res"); __PYX_ERR(0, 4884, __pyx_L1_error) } if (unlikely(!__pyx_cur_scope->__pyx_v_inp)) { __Pyx_RaiseClosureNameError("inp"); __PYX_ERR(0, 4884, __pyx_L1_error) } __Pyx_INCREF(__pyx_cur_scope->__pyx_v_analyze); __pyx_t_2 = __pyx_cur_scope->__pyx_v_analyze; __pyx_t_3 = NULL; __pyx_t_4 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_2))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); __pyx_t_4 = 1; } } #endif { PyObject *__pyx_callargs[3] = {__pyx_t_3, ((PyObject *)__pyx_cur_scope->__pyx_v_res), __pyx_cur_scope->__pyx_v_inp}; __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 2+__pyx_t_4); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4884, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
+4885: cy_analyze_f_ptr = (<cclm.analyze_cb*><size_t>ctypes.addressof(analyze_f))[0]
__Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_ctypes); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4885, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_addressof); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 4885, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = NULL; __pyx_t_7 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_11))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_11); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_11, function); __pyx_t_7 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v_analyze_f}; __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_11, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4885, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; } __pyx_t_13 = __Pyx_PyInt_As_size_t(__pyx_t_1); if (unlikely((__pyx_t_13 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 4885, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_cy_analyze_f_ptr = (((analyze_cb *)((size_t)__pyx_t_13))[0]);
+4886: res._analyzecallback = cy_analyze_f_ptr
__pyx_cur_scope->__pyx_v_res->_analyzecallback = __pyx_v_cy_analyze_f_ptr;
+4887: res.cache_append(analyze_f)
__pyx_t_1 = ((struct __pyx_vtabstruct_8pysndlib_3clm_mus_any *)__pyx_cur_scope->__pyx_v_res->__pyx_vtab)->cache_append(__pyx_cur_scope->__pyx_v_res, __pyx_v_analyze_f, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4887, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4888:
+4889: if (synthesize is not None):
__pyx_t_6 = (__pyx_cur_scope->__pyx_v_synthesize != Py_None);
if (__pyx_t_6) {
/* … */
}
+4890: @SYNTHESIZECALLBACK
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_18make_phase_vocoder_7synthesize_f(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_8pysndlib_3clm_18make_phase_vocoder_7synthesize_f = {"synthesize_f", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_18make_phase_vocoder_7synthesize_f, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_8pysndlib_3clm_18make_phase_vocoder_7synthesize_f(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
CYTHON_UNUSED PyObject *__pyx_v_gen = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("synthesize_f (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gen,0};
PyObject* values[1] = {0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_gen)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4890, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "synthesize_f") < 0)) __PYX_ERR(0, 4890, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 1)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
}
__pyx_v_gen = values[0];
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("synthesize_f", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 4890, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.make_phase_vocoder.synthesize_f", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_8pysndlib_3clm_18make_phase_vocoder_6synthesize_f(__pyx_self, __pyx_v_gen);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_18make_phase_vocoder_6synthesize_f(PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_gen) {
struct __pyx_obj_8pysndlib_3clm___pyx_scope_struct_4_make_phase_vocoder *__pyx_cur_scope;
struct __pyx_obj_8pysndlib_3clm___pyx_scope_struct_4_make_phase_vocoder *__pyx_outer_scope;
PyObject *__pyx_r = NULL;
__pyx_outer_scope = (struct __pyx_obj_8pysndlib_3clm___pyx_scope_struct_4_make_phase_vocoder *) __Pyx_CyFunction_GetClosure(__pyx_self);
__pyx_cur_scope = __pyx_outer_scope;
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_AddTraceback("pysndlib.clm.make_phase_vocoder.synthesize_f", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_SYNTHESIZECALLBACK); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 4890, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_11);
__pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_18make_phase_vocoder_7synthesize_f, 0, __pyx_n_s_make_phase_vocoder_locals_synthe, ((PyObject*)__pyx_cur_scope), __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__62)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4890, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_12 = NULL;
__pyx_t_7 = 0;
#if CYTHON_UNPACK_METHODS
if (unlikely(PyMethod_Check(__pyx_t_11))) {
__pyx_t_12 = PyMethod_GET_SELF(__pyx_t_11);
if (likely(__pyx_t_12)) {
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11);
__Pyx_INCREF(__pyx_t_12);
__Pyx_INCREF(function);
__Pyx_DECREF_SET(__pyx_t_11, function);
__pyx_t_7 = 1;
}
}
#endif
{
PyObject *__pyx_callargs[2] = {__pyx_t_12, __pyx_t_3};
__pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_11, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7);
__Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4890, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
}
__pyx_v_synthesize_f = __pyx_t_1;
__pyx_t_1 = 0;
/* … */
__pyx_codeobj__62 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__56, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_synthesize_f, 4890, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__62)) __PYX_ERR(0, 4890, __pyx_L1_error)
4891: def synthesize_f(gen):
+4892: return synthesize(res)
__Pyx_XDECREF(__pyx_r); if (unlikely(!__pyx_cur_scope->__pyx_v_synthesize)) { __Pyx_RaiseClosureNameError("synthesize"); __PYX_ERR(0, 4892, __pyx_L1_error) } if (unlikely(!__pyx_cur_scope->__pyx_v_res)) { __Pyx_RaiseClosureNameError("res"); __PYX_ERR(0, 4892, __pyx_L1_error) } __Pyx_INCREF(__pyx_cur_scope->__pyx_v_synthesize); __pyx_t_2 = __pyx_cur_scope->__pyx_v_synthesize; __pyx_t_3 = NULL; __pyx_t_4 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_2))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); __pyx_t_4 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_3, ((PyObject *)__pyx_cur_scope->__pyx_v_res)}; __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4892, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
+4893: cy_synthesize_f_ptr = (<cclm.synthesize_cb*><size_t>ctypes.addressof(synthesize_f))[0]
__Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_ctypes); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 4893, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_addressof); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4893, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; __pyx_t_11 = NULL; __pyx_t_7 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_3))) { __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_11)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_11); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); __pyx_t_7 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_11, __pyx_v_synthesize_f}; __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7); __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4893, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } __pyx_t_13 = __Pyx_PyInt_As_size_t(__pyx_t_1); if (unlikely((__pyx_t_13 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 4893, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_cy_synthesize_f_ptr = (((synthesize_cb *)((size_t)__pyx_t_13))[0]);
+4894: res._synthesizecallback = cy_synthesize_f_ptr
__pyx_cur_scope->__pyx_v_res->_synthesizecallback = __pyx_v_cy_synthesize_f_ptr;
+4895: res.cache_append(synthesize_f)
__pyx_t_1 = ((struct __pyx_vtabstruct_8pysndlib_3clm_mus_any *)__pyx_cur_scope->__pyx_v_res->__pyx_vtab)->cache_append(__pyx_cur_scope->__pyx_v_res, __pyx_v_synthesize_f, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4895, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4896:
+4897: return res
__Pyx_XDECREF(__pyx_r); __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_res); __pyx_r = ((PyObject *)__pyx_cur_scope->__pyx_v_res); goto __pyx_L0;
4898:
4899:
+4900: cpdef cython.double phase_vocoder(gen: mus_any):
static PyObject *__pyx_pw_8pysndlib_3clm_507phase_vocoder(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static double __pyx_f_8pysndlib_3clm_phase_vocoder(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, CYTHON_UNUSED int __pyx_skip_dispatch) {
double __pyx_r;
/* … */
/* function exit code */
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_507phase_vocoder(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_506phase_vocoder, "\n next phase vocoder value.\n \n :param gen: phase_vocoder gen\n :rtype: float\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_507phase_vocoder = {"phase_vocoder", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_507phase_vocoder, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_506phase_vocoder};
static PyObject *__pyx_pw_8pysndlib_3clm_507phase_vocoder(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("phase_vocoder (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gen,0};
PyObject* values[1] = {0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_gen)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4900, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "phase_vocoder") < 0)) __PYX_ERR(0, 4900, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 1)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
}
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)values[0]);
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("phase_vocoder", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 4900, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.phase_vocoder", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gen), __pyx_ptype_8pysndlib_3clm_mus_any, 0, "gen", 0))) __PYX_ERR(0, 4900, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_506phase_vocoder(__pyx_self, __pyx_v_gen);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_506phase_vocoder(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8pysndlib_3clm_phase_vocoder(__pyx_v_gen, 0); if (unlikely(__pyx_t_1 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 4900, __pyx_L1_error)
__pyx_t_2 = PyFloat_FromDouble(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4900, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("pysndlib.clm.phase_vocoder", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_37 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_37)) __PYX_ERR(0, 4900, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_37);
if (PyDict_SetItem(__pyx_t_37, __pyx_n_s_gen, __pyx_n_s_mus_any) < 0) __PYX_ERR(0, 4900, __pyx_L1_error)
__pyx_t_43 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_507phase_vocoder, 0, __pyx_n_s_phase_vocoder, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__561)); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 4900, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
__Pyx_CyFunction_SetAnnotationsDict(__pyx_t_43, __pyx_t_37);
__Pyx_DECREF(__pyx_t_37); __pyx_t_37 = 0;
if (PyDict_SetItem(__pyx_d, __pyx_n_s_phase_vocoder, __pyx_t_43) < 0) __PYX_ERR(0, 4900, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
/* … */
__pyx_codeobj__561 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__56, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_phase_vocoder, 4900, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__561)) __PYX_ERR(0, 4900, __pyx_L1_error)
4901: """
4902: next phase vocoder value.
4903:
4904: :param gen: phase_vocoder gen
4905: :rtype: float
4906: """
+4907: if gen._analyzecallback or gen._synthesizecallback or gen._editcallback :
__pyx_t_2 = (__pyx_v_gen->_analyzecallback != 0);
if (!__pyx_t_2) {
} else {
__pyx_t_1 = __pyx_t_2;
goto __pyx_L4_bool_binop_done;
}
__pyx_t_2 = (__pyx_v_gen->_synthesizecallback != 0);
if (!__pyx_t_2) {
} else {
__pyx_t_1 = __pyx_t_2;
goto __pyx_L4_bool_binop_done;
}
__pyx_t_2 = (__pyx_v_gen->_editcallback != 0);
__pyx_t_1 = __pyx_t_2;
__pyx_L4_bool_binop_done:;
if (__pyx_t_1) {
/* … */
}
+4908: return cclm.mus_phase_vocoder_with_editors(gen._ptr, gen._inputcallback, gen._analyzecallback, gen._editcallback, gen._synthesizecallback)
__pyx_r = mus_phase_vocoder_with_editors(__pyx_v_gen->_ptr, __pyx_v_gen->_inputcallback, __pyx_v_gen->_analyzecallback, __pyx_v_gen->_editcallback, __pyx_v_gen->_synthesizecallback);
goto __pyx_L0;
4909: else:
+4910: return cclm.mus_phase_vocoder(gen._ptr, gen._inputcallback)
/*else*/ {
__pyx_r = mus_phase_vocoder(__pyx_v_gen->_ptr, __pyx_v_gen->_inputcallback);
goto __pyx_L0;
}
4911:
+4912: cpdef bint is_phase_vocoder(gen: mus_any):
static PyObject *__pyx_pw_8pysndlib_3clm_509is_phase_vocoder(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static int __pyx_f_8pysndlib_3clm_is_phase_vocoder(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, CYTHON_UNUSED int __pyx_skip_dispatch) {
int __pyx_r;
/* … */
/* function exit code */
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_509is_phase_vocoder(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_508is_phase_vocoder, "\n returns True if gen is a phase_vocoder.\n \n :param gen: gen\n :rtype: bool\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_509is_phase_vocoder = {"is_phase_vocoder", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_509is_phase_vocoder, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_508is_phase_vocoder};
static PyObject *__pyx_pw_8pysndlib_3clm_509is_phase_vocoder(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("is_phase_vocoder (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gen,0};
PyObject* values[1] = {0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_gen)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4912, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "is_phase_vocoder") < 0)) __PYX_ERR(0, 4912, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 1)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
}
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)values[0]);
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("is_phase_vocoder", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 4912, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.is_phase_vocoder", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gen), __pyx_ptype_8pysndlib_3clm_mus_any, 0, "gen", 0))) __PYX_ERR(0, 4912, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_508is_phase_vocoder(__pyx_self, __pyx_v_gen);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_508is_phase_vocoder(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8pysndlib_3clm_is_phase_vocoder(__pyx_v_gen, 0); if (unlikely(__pyx_t_1 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 4912, __pyx_L1_error)
__pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4912, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("pysndlib.clm.is_phase_vocoder", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_43 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 4912, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
if (PyDict_SetItem(__pyx_t_43, __pyx_n_s_gen, __pyx_n_s_mus_any) < 0) __PYX_ERR(0, 4912, __pyx_L1_error)
__pyx_t_37 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_509is_phase_vocoder, 0, __pyx_n_s_is_phase_vocoder, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__562)); if (unlikely(!__pyx_t_37)) __PYX_ERR(0, 4912, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_37);
__Pyx_CyFunction_SetAnnotationsDict(__pyx_t_37, __pyx_t_43);
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
if (PyDict_SetItem(__pyx_d, __pyx_n_s_is_phase_vocoder, __pyx_t_37) < 0) __PYX_ERR(0, 4912, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_37); __pyx_t_37 = 0;
/* … */
__pyx_codeobj__562 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__56, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_is_phase_vocoder, 4912, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__562)) __PYX_ERR(0, 4912, __pyx_L1_error)
4913: """
4914: returns True if gen is a phase_vocoder.
4915:
4916: :param gen: gen
4917: :rtype: bool
4918: """
+4919: return cclm.mus_is_phase_vocoder(gen._ptr)
__pyx_r = mus_is_phase_vocoder(__pyx_v_gen->_ptr); goto __pyx_L0;
4920:
4921:
+4922: cpdef np.ndarray phase_vocoder_amp_increments(gen: mus_any):
static PyObject *__pyx_pw_8pysndlib_3clm_511phase_vocoder_amp_increments(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyArrayObject *__pyx_f_8pysndlib_3clm_phase_vocoder_amp_increments(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, CYTHON_UNUSED int __pyx_skip_dispatch) {
PyArrayObject *__pyx_r = NULL;
/* … */
/* function exit code */
__pyx_L0:;
__Pyx_XGIVEREF((PyObject *)__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_511phase_vocoder_amp_increments(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_510phase_vocoder_amp_increments, "\n returns a ndarray containing the current output sinusoid amplitude increments per sample.\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_511phase_vocoder_amp_increments = {"phase_vocoder_amp_increments", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_511phase_vocoder_amp_increments, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_510phase_vocoder_amp_increments};
static PyObject *__pyx_pw_8pysndlib_3clm_511phase_vocoder_amp_increments(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("phase_vocoder_amp_increments (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gen,0};
PyObject* values[1] = {0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_gen)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4922, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "phase_vocoder_amp_increments") < 0)) __PYX_ERR(0, 4922, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 1)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
}
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)values[0]);
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("phase_vocoder_amp_increments", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 4922, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.phase_vocoder_amp_increments", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gen), __pyx_ptype_8pysndlib_3clm_mus_any, 0, "gen", 0))) __PYX_ERR(0, 4922, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_510phase_vocoder_amp_increments(__pyx_self, __pyx_v_gen);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_510phase_vocoder_amp_increments(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = ((PyObject *)__pyx_f_8pysndlib_3clm_phase_vocoder_amp_increments(__pyx_v_gen, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4922, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("pysndlib.clm.phase_vocoder_amp_increments", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_37 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_37)) __PYX_ERR(0, 4922, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_37);
if (PyDict_SetItem(__pyx_t_37, __pyx_n_s_gen, __pyx_n_s_mus_any) < 0) __PYX_ERR(0, 4922, __pyx_L1_error)
__pyx_t_43 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_511phase_vocoder_amp_increments, 0, __pyx_n_s_phase_vocoder_amp_increments, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__563)); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 4922, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
__Pyx_CyFunction_SetAnnotationsDict(__pyx_t_43, __pyx_t_37);
__Pyx_DECREF(__pyx_t_37); __pyx_t_37 = 0;
if (PyDict_SetItem(__pyx_d, __pyx_n_s_phase_vocoder_amp_increments, __pyx_t_43) < 0) __PYX_ERR(0, 4922, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
/* … */
__pyx_codeobj__563 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__56, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_phase_vocoder_amp_increments, 4922, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__563)) __PYX_ERR(0, 4922, __pyx_L1_error)
4923: """
4924: returns a ndarray containing the current output sinusoid amplitude increments per sample.
4925: """
+4926: return gen._pv_amp_increments
__Pyx_XDECREF((PyObject *)__pyx_r); __Pyx_INCREF((PyObject *)__pyx_v_gen->_pv_amp_increments); __pyx_r = __pyx_v_gen->_pv_amp_increments; goto __pyx_L0;
4927:
+4928: cpdef np.ndarray phase_vocoder_amps(gen: mus_any):
static PyObject *__pyx_pw_8pysndlib_3clm_513phase_vocoder_amps(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyArrayObject *__pyx_f_8pysndlib_3clm_phase_vocoder_amps(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, CYTHON_UNUSED int __pyx_skip_dispatch) {
PyArrayObject *__pyx_r = NULL;
/* … */
/* function exit code */
__pyx_L0:;
__Pyx_XGIVEREF((PyObject *)__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_513phase_vocoder_amps(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_512phase_vocoder_amps, "\n returns a ndarray containing the current output sinusoid amplitudes.\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_513phase_vocoder_amps = {"phase_vocoder_amps", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_513phase_vocoder_amps, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_512phase_vocoder_amps};
static PyObject *__pyx_pw_8pysndlib_3clm_513phase_vocoder_amps(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("phase_vocoder_amps (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gen,0};
PyObject* values[1] = {0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_gen)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4928, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "phase_vocoder_amps") < 0)) __PYX_ERR(0, 4928, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 1)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
}
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)values[0]);
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("phase_vocoder_amps", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 4928, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.phase_vocoder_amps", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gen), __pyx_ptype_8pysndlib_3clm_mus_any, 0, "gen", 0))) __PYX_ERR(0, 4928, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_512phase_vocoder_amps(__pyx_self, __pyx_v_gen);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_512phase_vocoder_amps(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = ((PyObject *)__pyx_f_8pysndlib_3clm_phase_vocoder_amps(__pyx_v_gen, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4928, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("pysndlib.clm.phase_vocoder_amps", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_43 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 4928, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
if (PyDict_SetItem(__pyx_t_43, __pyx_n_s_gen, __pyx_n_s_mus_any) < 0) __PYX_ERR(0, 4928, __pyx_L1_error)
__pyx_t_37 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_513phase_vocoder_amps, 0, __pyx_n_s_phase_vocoder_amps, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__564)); if (unlikely(!__pyx_t_37)) __PYX_ERR(0, 4928, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_37);
__Pyx_CyFunction_SetAnnotationsDict(__pyx_t_37, __pyx_t_43);
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
if (PyDict_SetItem(__pyx_d, __pyx_n_s_phase_vocoder_amps, __pyx_t_37) < 0) __PYX_ERR(0, 4928, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_37); __pyx_t_37 = 0;
/* … */
__pyx_codeobj__564 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__56, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_phase_vocoder_amps, 4928, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__564)) __PYX_ERR(0, 4928, __pyx_L1_error)
4929: """
4930: returns a ndarray containing the current output sinusoid amplitudes.
4931: """
+4932: return gen._pv_amps
__Pyx_XDECREF((PyObject *)__pyx_r); __Pyx_INCREF((PyObject *)__pyx_v_gen->_pv_amps); __pyx_r = __pyx_v_gen->_pv_amps; goto __pyx_L0;
4933:
+4934: cpdef np.ndarray phase_vocoder_freqs(gen: mus_any):
static PyObject *__pyx_pw_8pysndlib_3clm_515phase_vocoder_freqs(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyArrayObject *__pyx_f_8pysndlib_3clm_phase_vocoder_freqs(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, CYTHON_UNUSED int __pyx_skip_dispatch) {
PyArrayObject *__pyx_r = NULL;
/* … */
/* function exit code */
__pyx_L0:;
__Pyx_XGIVEREF((PyObject *)__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_515phase_vocoder_freqs(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_514phase_vocoder_freqs, "\n returns a ndarray containing the current output sinusoid frequencies.\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_515phase_vocoder_freqs = {"phase_vocoder_freqs", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_515phase_vocoder_freqs, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_514phase_vocoder_freqs};
static PyObject *__pyx_pw_8pysndlib_3clm_515phase_vocoder_freqs(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("phase_vocoder_freqs (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gen,0};
PyObject* values[1] = {0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_gen)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4934, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "phase_vocoder_freqs") < 0)) __PYX_ERR(0, 4934, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 1)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
}
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)values[0]);
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("phase_vocoder_freqs", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 4934, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.phase_vocoder_freqs", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gen), __pyx_ptype_8pysndlib_3clm_mus_any, 0, "gen", 0))) __PYX_ERR(0, 4934, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_514phase_vocoder_freqs(__pyx_self, __pyx_v_gen);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_514phase_vocoder_freqs(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = ((PyObject *)__pyx_f_8pysndlib_3clm_phase_vocoder_freqs(__pyx_v_gen, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4934, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("pysndlib.clm.phase_vocoder_freqs", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_37 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_37)) __PYX_ERR(0, 4934, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_37);
if (PyDict_SetItem(__pyx_t_37, __pyx_n_s_gen, __pyx_n_s_mus_any) < 0) __PYX_ERR(0, 4934, __pyx_L1_error)
__pyx_t_43 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_515phase_vocoder_freqs, 0, __pyx_n_s_phase_vocoder_freqs, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__565)); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 4934, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
__Pyx_CyFunction_SetAnnotationsDict(__pyx_t_43, __pyx_t_37);
__Pyx_DECREF(__pyx_t_37); __pyx_t_37 = 0;
if (PyDict_SetItem(__pyx_d, __pyx_n_s_phase_vocoder_freqs, __pyx_t_43) < 0) __PYX_ERR(0, 4934, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
/* … */
__pyx_codeobj__565 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__56, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_phase_vocoder_freqs, 4934, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__565)) __PYX_ERR(0, 4934, __pyx_L1_error)
4935: """
4936: returns a ndarray containing the current output sinusoid frequencies.
4937: """
+4938: return gen._pv_freqs
__Pyx_XDECREF((PyObject *)__pyx_r); __Pyx_INCREF((PyObject *)__pyx_v_gen->_pv_freqs); __pyx_r = __pyx_v_gen->_pv_freqs; goto __pyx_L0;
4939:
+4940: cpdef np.ndarray phase_vocoder_phases(gen: mus_any):
static PyObject *__pyx_pw_8pysndlib_3clm_517phase_vocoder_phases(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyArrayObject *__pyx_f_8pysndlib_3clm_phase_vocoder_phases(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, CYTHON_UNUSED int __pyx_skip_dispatch) {
PyArrayObject *__pyx_r = NULL;
/* … */
/* function exit code */
__pyx_L0:;
__Pyx_XGIVEREF((PyObject *)__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_517phase_vocoder_phases(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_516phase_vocoder_phases, "\n returns a ndarray containing the current output sinusoid phases.\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_517phase_vocoder_phases = {"phase_vocoder_phases", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_517phase_vocoder_phases, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_516phase_vocoder_phases};
static PyObject *__pyx_pw_8pysndlib_3clm_517phase_vocoder_phases(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("phase_vocoder_phases (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gen,0};
PyObject* values[1] = {0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_gen)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4940, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "phase_vocoder_phases") < 0)) __PYX_ERR(0, 4940, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 1)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
}
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)values[0]);
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("phase_vocoder_phases", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 4940, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.phase_vocoder_phases", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gen), __pyx_ptype_8pysndlib_3clm_mus_any, 0, "gen", 0))) __PYX_ERR(0, 4940, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_516phase_vocoder_phases(__pyx_self, __pyx_v_gen);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_516phase_vocoder_phases(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = ((PyObject *)__pyx_f_8pysndlib_3clm_phase_vocoder_phases(__pyx_v_gen, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4940, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("pysndlib.clm.phase_vocoder_phases", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_43 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 4940, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
if (PyDict_SetItem(__pyx_t_43, __pyx_n_s_gen, __pyx_n_s_mus_any) < 0) __PYX_ERR(0, 4940, __pyx_L1_error)
__pyx_t_37 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_517phase_vocoder_phases, 0, __pyx_n_s_phase_vocoder_phases, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__566)); if (unlikely(!__pyx_t_37)) __PYX_ERR(0, 4940, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_37);
__Pyx_CyFunction_SetAnnotationsDict(__pyx_t_37, __pyx_t_43);
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
if (PyDict_SetItem(__pyx_d, __pyx_n_s_phase_vocoder_phases, __pyx_t_37) < 0) __PYX_ERR(0, 4940, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_37); __pyx_t_37 = 0;
/* … */
__pyx_codeobj__566 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__56, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_phase_vocoder_phases, 4940, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__566)) __PYX_ERR(0, 4940, __pyx_L1_error)
4941: """
4942: returns a ndarray containing the current output sinusoid phases.
4943: """
+4944: return gen._pv_phases
__Pyx_XDECREF((PyObject *)__pyx_r); __Pyx_INCREF((PyObject *)__pyx_v_gen->_pv_phases); __pyx_r = __pyx_v_gen->_pv_phases; goto __pyx_L0;
4945:
+4946: cpdef np.ndarray phase_vocoder_phase_increments(gen: mus_any):
static PyObject *__pyx_pw_8pysndlib_3clm_519phase_vocoder_phase_increments(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyArrayObject *__pyx_f_8pysndlib_3clm_phase_vocoder_phase_increments(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, CYTHON_UNUSED int __pyx_skip_dispatch) {
PyArrayObject *__pyx_r = NULL;
/* … */
/* function exit code */
__pyx_L0:;
__Pyx_XGIVEREF((PyObject *)__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_519phase_vocoder_phase_increments(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_518phase_vocoder_phase_increments, "\n returns a ndarray containing the current output sinusoid phase increments.\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_519phase_vocoder_phase_increments = {"phase_vocoder_phase_increments", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_519phase_vocoder_phase_increments, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_518phase_vocoder_phase_increments};
static PyObject *__pyx_pw_8pysndlib_3clm_519phase_vocoder_phase_increments(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("phase_vocoder_phase_increments (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gen,0};
PyObject* values[1] = {0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_gen)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4946, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "phase_vocoder_phase_increments") < 0)) __PYX_ERR(0, 4946, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 1)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
}
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)values[0]);
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("phase_vocoder_phase_increments", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 4946, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.phase_vocoder_phase_increments", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gen), __pyx_ptype_8pysndlib_3clm_mus_any, 0, "gen", 0))) __PYX_ERR(0, 4946, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_518phase_vocoder_phase_increments(__pyx_self, __pyx_v_gen);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_518phase_vocoder_phase_increments(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = ((PyObject *)__pyx_f_8pysndlib_3clm_phase_vocoder_phase_increments(__pyx_v_gen, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4946, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("pysndlib.clm.phase_vocoder_phase_increments", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_37 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_37)) __PYX_ERR(0, 4946, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_37);
if (PyDict_SetItem(__pyx_t_37, __pyx_n_s_gen, __pyx_n_s_mus_any) < 0) __PYX_ERR(0, 4946, __pyx_L1_error)
__pyx_t_43 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_519phase_vocoder_phase_increments, 0, __pyx_n_s_phase_vocoder_phase_increments, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__567)); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 4946, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
__Pyx_CyFunction_SetAnnotationsDict(__pyx_t_43, __pyx_t_37);
__Pyx_DECREF(__pyx_t_37); __pyx_t_37 = 0;
if (PyDict_SetItem(__pyx_d, __pyx_n_s_phase_vocoder_phase_increments, __pyx_t_43) < 0) __PYX_ERR(0, 4946, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
/* … */
__pyx_codeobj__567 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__56, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_phase_vocoder_phase_increments, 4946, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__567)) __PYX_ERR(0, 4946, __pyx_L1_error)
4947: """
4948: returns a ndarray containing the current output sinusoid phase increments.
4949: """
+4950: return gen._pv_phase_increments
__Pyx_XDECREF((PyObject *)__pyx_r); __Pyx_INCREF((PyObject *)__pyx_v_gen->_pv_phase_increments); __pyx_r = __pyx_v_gen->_pv_phase_increments; goto __pyx_L0;
4951:
4952: # --------------- out-any ---------------- #
+4953: cpdef out_any(loc: int, data: float, channel, output):
static PyObject *__pyx_pw_8pysndlib_3clm_521out_any(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyObject *__pyx_f_8pysndlib_3clm_out_any(PyObject *__pyx_v_loc, double __pyx_v_data, PyObject *__pyx_v_channel, PyObject *__pyx_v_output, CYTHON_UNUSED int __pyx_skip_dispatch) {
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_out = NULL;
PyObject *__pyx_r = NULL;
/* … */
/* function exit code */
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_XDECREF(__pyx_t_5);
__Pyx_XDECREF(__pyx_t_6);
__Pyx_AddTraceback("pysndlib.clm.out_any", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XDECREF((PyObject *)__pyx_v_out);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_521out_any(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_520out_any, "\n add data to output.\n \n :param loc: location to write to \\in samples\n :param data: sample value\n :param channel: channel to write to \n :param output: output to write to. can be an appropriately shaped np.ndarray or sample2file\n\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_521out_any = {"out_any", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_521out_any, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_520out_any};
static PyObject *__pyx_pw_8pysndlib_3clm_521out_any(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
PyObject *__pyx_v_loc = 0;
double __pyx_v_data;
PyObject *__pyx_v_channel = 0;
PyObject *__pyx_v_output = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("out_any (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_loc,&__pyx_n_s_data,&__pyx_n_s_channel,&__pyx_n_s_output,0};
PyObject* values[4] = {0,0,0,0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
CYTHON_FALLTHROUGH;
case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_loc)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4953, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_data)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4953, __pyx_L3_error)
else {
__Pyx_RaiseArgtupleInvalid("out_any", 1, 4, 4, 1); __PYX_ERR(0, 4953, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 2:
if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_channel)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[2]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4953, __pyx_L3_error)
else {
__Pyx_RaiseArgtupleInvalid("out_any", 1, 4, 4, 2); __PYX_ERR(0, 4953, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 3:
if (likely((values[3] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_output)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[3]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4953, __pyx_L3_error)
else {
__Pyx_RaiseArgtupleInvalid("out_any", 1, 4, 4, 3); __PYX_ERR(0, 4953, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "out_any") < 0)) __PYX_ERR(0, 4953, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 4)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
}
__pyx_v_loc = ((PyObject*)values[0]);
__pyx_v_data = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_data == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 4953, __pyx_L3_error)
__pyx_v_channel = values[2];
__pyx_v_output = values[3];
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("out_any", 1, 4, 4, __pyx_nargs); __PYX_ERR(0, 4953, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.out_any", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_loc), (&PyInt_Type), 0, "loc", 1))) __PYX_ERR(0, 4953, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_520out_any(__pyx_self, __pyx_v_loc, __pyx_v_data, __pyx_v_channel, __pyx_v_output);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_520out_any(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_loc, double __pyx_v_data, PyObject *__pyx_v_channel, PyObject *__pyx_v_output) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8pysndlib_3clm_out_any(__pyx_v_loc, __pyx_v_data, __pyx_v_channel, __pyx_v_output, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4953, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("pysndlib.clm.out_any", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_tuple__568 = PyTuple_Pack(4, __pyx_n_s_loc, __pyx_n_s_data, __pyx_n_s_channel, __pyx_n_s_output); if (unlikely(!__pyx_tuple__568)) __PYX_ERR(0, 4953, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__568);
__Pyx_GIVEREF(__pyx_tuple__568);
/* … */
__pyx_t_43 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 4953, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
if (PyDict_SetItem(__pyx_t_43, __pyx_n_s_loc, __pyx_n_s_int_2) < 0) __PYX_ERR(0, 4953, __pyx_L1_error)
if (PyDict_SetItem(__pyx_t_43, __pyx_n_s_data, __pyx_n_s_float) < 0) __PYX_ERR(0, 4953, __pyx_L1_error)
__pyx_t_37 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_521out_any, 0, __pyx_n_s_out_any, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__569)); if (unlikely(!__pyx_t_37)) __PYX_ERR(0, 4953, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_37);
__Pyx_CyFunction_SetAnnotationsDict(__pyx_t_37, __pyx_t_43);
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
if (PyDict_SetItem(__pyx_d, __pyx_n_s_out_any, __pyx_t_37) < 0) __PYX_ERR(0, 4953, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_37); __pyx_t_37 = 0;
__pyx_codeobj__569 = (PyObject*)__Pyx_PyCode_New(4, 0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__568, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_out_any, 4953, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__569)) __PYX_ERR(0, 4953, __pyx_L1_error)
4954: """
4955: add data to output.
4956:
4957: :param loc: location to write to \in samples
4958: :param data: sample value
4959: :param channel: channel to write to
4960: :param output: output to write to. can be an appropriately shaped np.ndarray or sample2file
4961:
4962: """
+4963: if isinstance(output, np.ndarray):
__pyx_t_1 = __Pyx_TypeCheck(__pyx_v_output, __pyx_ptype_5numpy_ndarray);
if (__pyx_t_1) {
/* … */
goto __pyx_L3;
}
+4964: output[channel][loc] += data
__pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_v_output, __pyx_v_channel); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4964, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_v_loc); __pyx_t_3 = __pyx_v_loc; __pyx_t_4 = __Pyx_PyObject_GetItem(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4964, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = PyFloat_FromDouble(__pyx_v_data); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4964, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_6 = PyNumber_InPlaceAdd(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 4964, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (unlikely((PyObject_SetItem(__pyx_t_2, __pyx_t_3, __pyx_t_6) < 0))) __PYX_ERR(0, 4964, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4965: else:
+4966: out = <mus_any>output
/*else*/ {
__pyx_t_2 = __pyx_v_output;
__Pyx_INCREF(__pyx_t_2);
__pyx_v_out = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_t_2);
__pyx_t_2 = 0;
+4967: cclm.mus_out_any(loc, data, channel, out._ptr)
__pyx_t_7 = __Pyx_PyInt_As_int64_t(__pyx_v_loc); if (unlikely((__pyx_t_7 == ((mus_long_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 4967, __pyx_L1_error) __pyx_t_8 = __Pyx_PyInt_As_int(__pyx_v_channel); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 4967, __pyx_L1_error) (void)(mus_out_any(__pyx_t_7, __pyx_v_data, __pyx_t_8, __pyx_v_out->_ptr)); } __pyx_L3:;
4968:
4969: # --------------- outa ---------------- #
+4970: cpdef outa(loc: int, data: float, output=None):
static PyObject *__pyx_pw_8pysndlib_3clm_523outa(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyObject *__pyx_f_8pysndlib_3clm_outa(PyObject *__pyx_v_loc, double __pyx_v_data, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_8pysndlib_3clm_outa *__pyx_optional_args) {
PyObject *__pyx_v_output = ((PyObject *)Py_None);
PyObject *__pyx_r = NULL;
if (__pyx_optional_args) {
if (__pyx_optional_args->__pyx_n > 0) {
__pyx_v_output = __pyx_optional_args->output;
}
}
/* … */
/* function exit code */
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_AddTraceback("pysndlib.clm.outa", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_523outa(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_522outa, "\n add data to output \\in channel 0.\n \n :param loc: location to write to \\in samples\n :param data: sample value\n :param channel: channel to write to \n :param output: output to write to. can be an appropriately shaped np.ndarray or sample2file\n\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_523outa = {"outa", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_523outa, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_522outa};
static PyObject *__pyx_pw_8pysndlib_3clm_523outa(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
PyObject *__pyx_v_loc = 0;
double __pyx_v_data;
PyObject *__pyx_v_output = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("outa (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_loc,&__pyx_n_s_data,&__pyx_n_s_output,0};
PyObject* values[3] = {0,0,0};
values[2] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_loc)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4970, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_data)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4970, __pyx_L3_error)
else {
__Pyx_RaiseArgtupleInvalid("outa", 0, 2, 3, 1); __PYX_ERR(0, 4970, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 2:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_output);
if (value) { values[2] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4970, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "outa") < 0)) __PYX_ERR(0, 4970, __pyx_L3_error)
}
} else {
switch (__pyx_nargs) {
case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
break;
default: goto __pyx_L5_argtuple_error;
}
}
__pyx_v_loc = ((PyObject*)values[0]);
__pyx_v_data = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_data == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 4970, __pyx_L3_error)
__pyx_v_output = values[2];
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("outa", 0, 2, 3, __pyx_nargs); __PYX_ERR(0, 4970, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.outa", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_loc), (&PyInt_Type), 0, "loc", 1))) __PYX_ERR(0, 4970, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_522outa(__pyx_self, __pyx_v_loc, __pyx_v_data, __pyx_v_output);
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_522outa(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_loc, double __pyx_v_data, PyObject *__pyx_v_output) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_2.__pyx_n = 1;
__pyx_t_2.output = __pyx_v_output;
__pyx_t_1 = __pyx_f_8pysndlib_3clm_outa(__pyx_v_loc, __pyx_v_data, 0, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4970, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("pysndlib.clm.outa", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_tuple__570 = PyTuple_Pack(3, __pyx_n_s_loc, __pyx_n_s_data, __pyx_n_s_output); if (unlikely(!__pyx_tuple__570)) __PYX_ERR(0, 4970, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__570);
__Pyx_GIVEREF(__pyx_tuple__570);
/* … */
__pyx_t_37 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_37)) __PYX_ERR(0, 4970, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_37);
if (PyDict_SetItem(__pyx_t_37, __pyx_n_s_loc, __pyx_n_s_int_2) < 0) __PYX_ERR(0, 4970, __pyx_L1_error)
if (PyDict_SetItem(__pyx_t_37, __pyx_n_s_data, __pyx_n_s_float) < 0) __PYX_ERR(0, 4970, __pyx_L1_error)
__pyx_t_43 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_523outa, 0, __pyx_n_s_outa, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__571)); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 4970, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
__Pyx_CyFunction_SetDefaultsTuple(__pyx_t_43, __pyx_tuple__90);
__Pyx_CyFunction_SetAnnotationsDict(__pyx_t_43, __pyx_t_37);
__Pyx_DECREF(__pyx_t_37); __pyx_t_37 = 0;
if (PyDict_SetItem(__pyx_d, __pyx_n_s_outa, __pyx_t_43) < 0) __PYX_ERR(0, 4970, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
__pyx_codeobj__571 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__570, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_outa, 4970, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__571)) __PYX_ERR(0, 4970, __pyx_L1_error)
/* … */
struct __pyx_opt_args_8pysndlib_3clm_outa {
int __pyx_n;
PyObject *output;
};
4971: """
4972: add data to output \in channel 0.
4973:
4974: :param loc: location to write to \in samples
4975: :param data: sample value
4976: :param channel: channel to write to
4977: :param output: output to write to. can be an appropriately shaped np.ndarray or sample2file
4978:
4979: """
+4980: if output is not None:
__pyx_t_1 = (__pyx_v_output != Py_None);
if (__pyx_t_1) {
/* … */
goto __pyx_L3;
}
+4981: out_any(loc, data, 0, output)
__pyx_t_2 = __pyx_f_8pysndlib_3clm_out_any(__pyx_v_loc, __pyx_v_data, __pyx_int_0, __pyx_v_output, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4981, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4982: else:
+4983: out_any(loc, data, 0, CLM.output)
/*else*/ {
__Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_CLM); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4983, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_output); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4983, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_t_2 = __pyx_f_8pysndlib_3clm_out_any(__pyx_v_loc, __pyx_v_data, __pyx_int_0, __pyx_t_3, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4983, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
}
__pyx_L3:;
4984:
4985: # --------------- outb ---------------- #
+4986: cpdef outb(loc: int, data: float, output=None):
static PyObject *__pyx_pw_8pysndlib_3clm_525outb(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyObject *__pyx_f_8pysndlib_3clm_outb(PyObject *__pyx_v_loc, double __pyx_v_data, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_8pysndlib_3clm_outb *__pyx_optional_args) {
PyObject *__pyx_v_output = ((PyObject *)Py_None);
PyObject *__pyx_r = NULL;
if (__pyx_optional_args) {
if (__pyx_optional_args->__pyx_n > 0) {
__pyx_v_output = __pyx_optional_args->output;
}
}
/* … */
/* function exit code */
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_AddTraceback("pysndlib.clm.outb", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_525outb(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_524outb, "\n add data to output \\in channel 1.\n \n :param loc: location to write to \\in samples\n :param data: sample value\n :param channel: channel to write to \n :param output: output to write to. can be an appropriately shaped np.ndarray or sample2fil\n\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_525outb = {"outb", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_525outb, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_524outb};
static PyObject *__pyx_pw_8pysndlib_3clm_525outb(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
PyObject *__pyx_v_loc = 0;
double __pyx_v_data;
PyObject *__pyx_v_output = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("outb (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_loc,&__pyx_n_s_data,&__pyx_n_s_output,0};
PyObject* values[3] = {0,0,0};
values[2] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_loc)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4986, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_data)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4986, __pyx_L3_error)
else {
__Pyx_RaiseArgtupleInvalid("outb", 0, 2, 3, 1); __PYX_ERR(0, 4986, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 2:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_output);
if (value) { values[2] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4986, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "outb") < 0)) __PYX_ERR(0, 4986, __pyx_L3_error)
}
} else {
switch (__pyx_nargs) {
case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
break;
default: goto __pyx_L5_argtuple_error;
}
}
__pyx_v_loc = ((PyObject*)values[0]);
__pyx_v_data = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_data == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 4986, __pyx_L3_error)
__pyx_v_output = values[2];
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("outb", 0, 2, 3, __pyx_nargs); __PYX_ERR(0, 4986, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.outb", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_loc), (&PyInt_Type), 0, "loc", 1))) __PYX_ERR(0, 4986, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_524outb(__pyx_self, __pyx_v_loc, __pyx_v_data, __pyx_v_output);
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_524outb(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_loc, double __pyx_v_data, PyObject *__pyx_v_output) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_2.__pyx_n = 1;
__pyx_t_2.output = __pyx_v_output;
__pyx_t_1 = __pyx_f_8pysndlib_3clm_outb(__pyx_v_loc, __pyx_v_data, 0, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4986, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("pysndlib.clm.outb", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_43 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 4986, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
if (PyDict_SetItem(__pyx_t_43, __pyx_n_s_loc, __pyx_n_s_int_2) < 0) __PYX_ERR(0, 4986, __pyx_L1_error)
if (PyDict_SetItem(__pyx_t_43, __pyx_n_s_data, __pyx_n_s_float) < 0) __PYX_ERR(0, 4986, __pyx_L1_error)
__pyx_t_37 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_525outb, 0, __pyx_n_s_outb, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__572)); if (unlikely(!__pyx_t_37)) __PYX_ERR(0, 4986, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_37);
__Pyx_CyFunction_SetDefaultsTuple(__pyx_t_37, __pyx_tuple__90);
__Pyx_CyFunction_SetAnnotationsDict(__pyx_t_37, __pyx_t_43);
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
if (PyDict_SetItem(__pyx_d, __pyx_n_s_outb, __pyx_t_37) < 0) __PYX_ERR(0, 4986, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_37); __pyx_t_37 = 0;
/* … */
__pyx_codeobj__572 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__570, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_outb, 4986, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__572)) __PYX_ERR(0, 4986, __pyx_L1_error)
/* … */
struct __pyx_opt_args_8pysndlib_3clm_outb {
int __pyx_n;
PyObject *output;
};
4987: """
4988: add data to output \in channel 1.
4989:
4990: :param loc: location to write to \in samples
4991: :param data: sample value
4992: :param channel: channel to write to
4993: :param output: output to write to. can be an appropriately shaped np.ndarray or sample2fil
4994:
4995: """
+4996: if output is not None:
__pyx_t_1 = (__pyx_v_output != Py_None);
if (__pyx_t_1) {
/* … */
goto __pyx_L3;
}
+4997: out_any(loc, data, 1, output)
__pyx_t_2 = __pyx_f_8pysndlib_3clm_out_any(__pyx_v_loc, __pyx_v_data, __pyx_int_1, __pyx_v_output, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4997, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4998: else:
+4999: out_any(loc, data, 1, CLM.output)
/*else*/ {
__Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_CLM); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4999, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_output); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4999, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_t_2 = __pyx_f_8pysndlib_3clm_out_any(__pyx_v_loc, __pyx_v_data, __pyx_int_1, __pyx_t_3, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4999, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
}
__pyx_L3:;
5000:
5001: # --------------- outc ---------------- #
+5002: cpdef outc(loc: int, data: float, output=None):
static PyObject *__pyx_pw_8pysndlib_3clm_527outc(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyObject *__pyx_f_8pysndlib_3clm_outc(PyObject *__pyx_v_loc, double __pyx_v_data, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_8pysndlib_3clm_outc *__pyx_optional_args) {
PyObject *__pyx_v_output = ((PyObject *)Py_None);
PyObject *__pyx_r = NULL;
if (__pyx_optional_args) {
if (__pyx_optional_args->__pyx_n > 0) {
__pyx_v_output = __pyx_optional_args->output;
}
}
/* … */
/* function exit code */
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_AddTraceback("pysndlib.clm.outc", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_527outc(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_526outc, "\n add data to output \\in channel 2.\n \n :param loc: location to write to \\in samples\n :param data: sample value\n :param channel: channel to write to \n :param output: output to write to. can be an appropriately shaped np.ndarray or sample2file\n\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_527outc = {"outc", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_527outc, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_526outc};
static PyObject *__pyx_pw_8pysndlib_3clm_527outc(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
PyObject *__pyx_v_loc = 0;
double __pyx_v_data;
PyObject *__pyx_v_output = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("outc (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_loc,&__pyx_n_s_data,&__pyx_n_s_output,0};
PyObject* values[3] = {0,0,0};
values[2] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_loc)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 5002, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_data)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 5002, __pyx_L3_error)
else {
__Pyx_RaiseArgtupleInvalid("outc", 0, 2, 3, 1); __PYX_ERR(0, 5002, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 2:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_output);
if (value) { values[2] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 5002, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "outc") < 0)) __PYX_ERR(0, 5002, __pyx_L3_error)
}
} else {
switch (__pyx_nargs) {
case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
break;
default: goto __pyx_L5_argtuple_error;
}
}
__pyx_v_loc = ((PyObject*)values[0]);
__pyx_v_data = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_data == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 5002, __pyx_L3_error)
__pyx_v_output = values[2];
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("outc", 0, 2, 3, __pyx_nargs); __PYX_ERR(0, 5002, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.outc", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_loc), (&PyInt_Type), 0, "loc", 1))) __PYX_ERR(0, 5002, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_526outc(__pyx_self, __pyx_v_loc, __pyx_v_data, __pyx_v_output);
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_526outc(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_loc, double __pyx_v_data, PyObject *__pyx_v_output) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_2.__pyx_n = 1;
__pyx_t_2.output = __pyx_v_output;
__pyx_t_1 = __pyx_f_8pysndlib_3clm_outc(__pyx_v_loc, __pyx_v_data, 0, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5002, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("pysndlib.clm.outc", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_37 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_37)) __PYX_ERR(0, 5002, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_37);
if (PyDict_SetItem(__pyx_t_37, __pyx_n_s_loc, __pyx_n_s_int_2) < 0) __PYX_ERR(0, 5002, __pyx_L1_error)
if (PyDict_SetItem(__pyx_t_37, __pyx_n_s_data, __pyx_n_s_float) < 0) __PYX_ERR(0, 5002, __pyx_L1_error)
__pyx_t_43 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_527outc, 0, __pyx_n_s_outc, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__573)); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 5002, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
__Pyx_CyFunction_SetDefaultsTuple(__pyx_t_43, __pyx_tuple__90);
__Pyx_CyFunction_SetAnnotationsDict(__pyx_t_43, __pyx_t_37);
__Pyx_DECREF(__pyx_t_37); __pyx_t_37 = 0;
if (PyDict_SetItem(__pyx_d, __pyx_n_s_outc, __pyx_t_43) < 0) __PYX_ERR(0, 5002, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
/* … */
__pyx_codeobj__573 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__570, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_outc, 5002, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__573)) __PYX_ERR(0, 5002, __pyx_L1_error)
/* … */
struct __pyx_opt_args_8pysndlib_3clm_outc {
int __pyx_n;
PyObject *output;
};
5003: """
5004: add data to output \in channel 2.
5005:
5006: :param loc: location to write to \in samples
5007: :param data: sample value
5008: :param channel: channel to write to
5009: :param output: output to write to. can be an appropriately shaped np.ndarray or sample2file
5010:
5011: """
+5012: if output is not None:
__pyx_t_1 = (__pyx_v_output != Py_None);
if (__pyx_t_1) {
/* … */
goto __pyx_L3;
}
+5013: out_any(loc, data, 2, output)
__pyx_t_2 = __pyx_f_8pysndlib_3clm_out_any(__pyx_v_loc, __pyx_v_data, __pyx_int_2, __pyx_v_output, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 5013, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5014: else:
+5015: out_any(loc, data, 2, CLM.output)
/*else*/ {
__Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_CLM); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 5015, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_output); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 5015, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_t_2 = __pyx_f_8pysndlib_3clm_out_any(__pyx_v_loc, __pyx_v_data, __pyx_int_2, __pyx_t_3, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 5015, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
}
__pyx_L3:;
5016:
5017: # --------------- outd ---------------- #
+5018: cpdef outd(loc: int, data: float, output=None):
static PyObject *__pyx_pw_8pysndlib_3clm_529outd(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyObject *__pyx_f_8pysndlib_3clm_outd(PyObject *__pyx_v_loc, double __pyx_v_data, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_8pysndlib_3clm_outd *__pyx_optional_args) {
PyObject *__pyx_v_output = ((PyObject *)Py_None);
PyObject *__pyx_r = NULL;
if (__pyx_optional_args) {
if (__pyx_optional_args->__pyx_n > 0) {
__pyx_v_output = __pyx_optional_args->output;
}
}
/* … */
/* function exit code */
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_AddTraceback("pysndlib.clm.outd", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_529outd(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_528outd, "\n add data to output \\in channel 3.\n \n :param loc: location to write to \\in samples\n :param data: sample value\n :param channel: channel to write to \n :param output: output to write to. can be an appropriately shaped np.ndarray or sample2file\n\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_529outd = {"outd", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_529outd, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_528outd};
static PyObject *__pyx_pw_8pysndlib_3clm_529outd(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
PyObject *__pyx_v_loc = 0;
double __pyx_v_data;
PyObject *__pyx_v_output = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("outd (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_loc,&__pyx_n_s_data,&__pyx_n_s_output,0};
PyObject* values[3] = {0,0,0};
values[2] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_loc)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 5018, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_data)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 5018, __pyx_L3_error)
else {
__Pyx_RaiseArgtupleInvalid("outd", 0, 2, 3, 1); __PYX_ERR(0, 5018, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 2:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_output);
if (value) { values[2] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 5018, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "outd") < 0)) __PYX_ERR(0, 5018, __pyx_L3_error)
}
} else {
switch (__pyx_nargs) {
case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
break;
default: goto __pyx_L5_argtuple_error;
}
}
__pyx_v_loc = ((PyObject*)values[0]);
__pyx_v_data = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_data == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 5018, __pyx_L3_error)
__pyx_v_output = values[2];
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("outd", 0, 2, 3, __pyx_nargs); __PYX_ERR(0, 5018, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.outd", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_loc), (&PyInt_Type), 0, "loc", 1))) __PYX_ERR(0, 5018, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_528outd(__pyx_self, __pyx_v_loc, __pyx_v_data, __pyx_v_output);
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_528outd(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_loc, double __pyx_v_data, PyObject *__pyx_v_output) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_2.__pyx_n = 1;
__pyx_t_2.output = __pyx_v_output;
__pyx_t_1 = __pyx_f_8pysndlib_3clm_outd(__pyx_v_loc, __pyx_v_data, 0, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5018, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("pysndlib.clm.outd", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_43 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 5018, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
if (PyDict_SetItem(__pyx_t_43, __pyx_n_s_loc, __pyx_n_s_int_2) < 0) __PYX_ERR(0, 5018, __pyx_L1_error)
if (PyDict_SetItem(__pyx_t_43, __pyx_n_s_data, __pyx_n_s_float) < 0) __PYX_ERR(0, 5018, __pyx_L1_error)
__pyx_t_37 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_529outd, 0, __pyx_n_s_outd, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__574)); if (unlikely(!__pyx_t_37)) __PYX_ERR(0, 5018, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_37);
__Pyx_CyFunction_SetDefaultsTuple(__pyx_t_37, __pyx_tuple__90);
__Pyx_CyFunction_SetAnnotationsDict(__pyx_t_37, __pyx_t_43);
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
if (PyDict_SetItem(__pyx_d, __pyx_n_s_outd, __pyx_t_37) < 0) __PYX_ERR(0, 5018, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_37); __pyx_t_37 = 0;
/* … */
__pyx_codeobj__574 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__570, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_outd, 5018, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__574)) __PYX_ERR(0, 5018, __pyx_L1_error)
/* … */
struct __pyx_opt_args_8pysndlib_3clm_outd {
int __pyx_n;
PyObject *output;
};
5019: """
5020: add data to output \in channel 3.
5021:
5022: :param loc: location to write to \in samples
5023: :param data: sample value
5024: :param channel: channel to write to
5025: :param output: output to write to. can be an appropriately shaped np.ndarray or sample2file
5026:
5027: """
+5028: if output is not None:
__pyx_t_1 = (__pyx_v_output != Py_None);
if (__pyx_t_1) {
/* … */
goto __pyx_L3;
}
+5029: out_any(loc, data, 3, output)
__pyx_t_2 = __pyx_f_8pysndlib_3clm_out_any(__pyx_v_loc, __pyx_v_data, __pyx_int_3, __pyx_v_output, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 5029, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5030: else:
+5031: out_any(loc, data, 3, CLM.output)
/*else*/ {
__Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_CLM); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 5031, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_output); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 5031, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_t_2 = __pyx_f_8pysndlib_3clm_out_any(__pyx_v_loc, __pyx_v_data, __pyx_int_3, __pyx_t_3, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 5031, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
}
__pyx_L3:;
5032:
5033: #
5034: # --------------- out-bank ---------------- #
+5035: cpdef out_bank(gens, loc: int, val: float):
static PyObject *__pyx_pw_8pysndlib_3clm_531out_bank(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyObject *__pyx_f_8pysndlib_3clm_out_bank(PyObject *__pyx_v_gens, PyObject *__pyx_v_loc, double __pyx_v_val, CYTHON_UNUSED int __pyx_skip_dispatch) {
Py_ssize_t __pyx_v_i;
PyObject *__pyx_v_gen = NULL;
PyObject *__pyx_r = NULL;
/* … */
/* function exit code */
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_4);
__Pyx_XDECREF(__pyx_t_5);
__Pyx_XDECREF(__pyx_t_6);
__Pyx_XDECREF(__pyx_t_7);
__Pyx_AddTraceback("pysndlib.clm.out_bank", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XDECREF(__pyx_v_gen);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_531out_bank(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_530out_bank, "\n calls each generator \\in the gens list, passing it the argument val, then sends that output to the output channels \\in the list order (the first generator writes to outa, the second to outb, etc).\"\n\n :param gens: gens to call\n :param loca: location in samples to write to\n :return: data\n :rtype: float\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_531out_bank = {"out_bank", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_531out_bank, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_530out_bank};
static PyObject *__pyx_pw_8pysndlib_3clm_531out_bank(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
PyObject *__pyx_v_gens = 0;
PyObject *__pyx_v_loc = 0;
double __pyx_v_val;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("out_bank (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gens,&__pyx_n_s_loc,&__pyx_n_s_val,0};
PyObject* values[3] = {0,0,0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_gens)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 5035, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_loc)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 5035, __pyx_L3_error)
else {
__Pyx_RaiseArgtupleInvalid("out_bank", 1, 3, 3, 1); __PYX_ERR(0, 5035, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 2:
if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_val)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[2]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 5035, __pyx_L3_error)
else {
__Pyx_RaiseArgtupleInvalid("out_bank", 1, 3, 3, 2); __PYX_ERR(0, 5035, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "out_bank") < 0)) __PYX_ERR(0, 5035, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 3)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
}
__pyx_v_gens = values[0];
__pyx_v_loc = ((PyObject*)values[1]);
__pyx_v_val = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_val == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 5035, __pyx_L3_error)
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("out_bank", 1, 3, 3, __pyx_nargs); __PYX_ERR(0, 5035, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.out_bank", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_loc), (&PyInt_Type), 0, "loc", 1))) __PYX_ERR(0, 5035, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_530out_bank(__pyx_self, __pyx_v_gens, __pyx_v_loc, __pyx_v_val);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_530out_bank(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_gens, PyObject *__pyx_v_loc, double __pyx_v_val) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8pysndlib_3clm_out_bank(__pyx_v_gens, __pyx_v_loc, __pyx_v_val, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5035, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("pysndlib.clm.out_bank", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_tuple__575 = PyTuple_Pack(3, __pyx_n_s_gens, __pyx_n_s_loc, __pyx_n_s_val); if (unlikely(!__pyx_tuple__575)) __PYX_ERR(0, 5035, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__575);
__Pyx_GIVEREF(__pyx_tuple__575);
/* … */
__pyx_t_37 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_37)) __PYX_ERR(0, 5035, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_37);
if (PyDict_SetItem(__pyx_t_37, __pyx_n_s_loc, __pyx_n_s_int_2) < 0) __PYX_ERR(0, 5035, __pyx_L1_error)
if (PyDict_SetItem(__pyx_t_37, __pyx_n_s_val, __pyx_n_s_float) < 0) __PYX_ERR(0, 5035, __pyx_L1_error)
__pyx_t_43 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_531out_bank, 0, __pyx_n_s_out_bank, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__576)); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 5035, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
__Pyx_CyFunction_SetAnnotationsDict(__pyx_t_43, __pyx_t_37);
__Pyx_DECREF(__pyx_t_37); __pyx_t_37 = 0;
if (PyDict_SetItem(__pyx_d, __pyx_n_s_out_bank, __pyx_t_43) < 0) __PYX_ERR(0, 5035, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
__pyx_codeobj__576 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__575, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_out_bank, 5035, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__576)) __PYX_ERR(0, 5035, __pyx_L1_error)
5036: """
5037: calls each generator \in the gens list, passing it the argument val, then sends that output to the output channels \in the list order (the first generator writes to outa, the second to outb, etc)."
5038:
5039: :param gens: gens to call
5040: :param loca: location in samples to write to
5041: :return: data
5042: :rtype: float
5043: """
+5044: for i in range(len(gens)):
__pyx_t_1 = PyObject_Length(__pyx_v_gens); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 5044, __pyx_L1_error) __pyx_t_2 = __pyx_t_1; for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { __pyx_v_i = __pyx_t_3;
+5045: gen = gens[i]
__pyx_t_4 = __Pyx_GetItemInt(__pyx_v_gens, __pyx_v_i, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 1, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 5045, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_XDECREF_SET(__pyx_v_gen, __pyx_t_4); __pyx_t_4 = 0;
+5046: out_any(loc, gen(val, 0.), i, CLM.output)
__pyx_t_5 = PyFloat_FromDouble(__pyx_v_val); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 5046, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_INCREF(__pyx_v_gen); __pyx_t_6 = __pyx_v_gen; __pyx_t_7 = NULL; __pyx_t_8 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_6))) { __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6); if (likely(__pyx_t_7)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); __Pyx_INCREF(__pyx_t_7); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_6, function); __pyx_t_8 = 1; } } #endif { PyObject *__pyx_callargs[3] = {__pyx_t_7, __pyx_t_5, __pyx_float_0_}; __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+1-__pyx_t_8, 2+__pyx_t_8); __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 5046, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; } __pyx_t_9 = __pyx_PyFloat_AsDouble(__pyx_t_4); if (unlikely((__pyx_t_9 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 5046, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_i); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 5046, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_CLM); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 5046, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_output); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 5046, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_6 = __pyx_f_8pysndlib_3clm_out_any(__pyx_v_loc, __pyx_t_9, __pyx_t_4, __pyx_t_5, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 5046, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; }
5047: # the below stopped working for some reason
5048: # out_any(loc, cclm.mus_apply((<cclm.mus_any_ptr>gens[i])._ptr, val, 0.), i, CLM.output)
5049:
5050:
5051: #--------------- in-any ----------------#
+5052: cpdef in_any(loc: int, channel: int, inp):
static PyObject *__pyx_pw_8pysndlib_3clm_533in_any(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyObject *__pyx_f_8pysndlib_3clm_in_any(PyObject *__pyx_v_loc, PyObject *__pyx_v_channel, PyObject *__pyx_v_inp, CYTHON_UNUSED int __pyx_skip_dispatch) {
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_ipt = NULL;
PyObject *__pyx_r = NULL;
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_AddTraceback("pysndlib.clm.in_any", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XDECREF((PyObject *)__pyx_v_ipt);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_533in_any(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_532in_any, "\n input stream sample at loc \\in channel chan.\n \n :param loc: location to read from\n :param channel: channel to read from \n :param inp: input to read from. can be an appropriately shaped np.ndarray or file2sample\n :return: data\n :rtype: float\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_533in_any = {"in_any", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_533in_any, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_532in_any};
static PyObject *__pyx_pw_8pysndlib_3clm_533in_any(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
PyObject *__pyx_v_loc = 0;
PyObject *__pyx_v_channel = 0;
PyObject *__pyx_v_inp = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("in_any (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_loc,&__pyx_n_s_channel,&__pyx_n_s_inp,0};
PyObject* values[3] = {0,0,0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_loc)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 5052, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_channel)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 5052, __pyx_L3_error)
else {
__Pyx_RaiseArgtupleInvalid("in_any", 1, 3, 3, 1); __PYX_ERR(0, 5052, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 2:
if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_inp)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[2]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 5052, __pyx_L3_error)
else {
__Pyx_RaiseArgtupleInvalid("in_any", 1, 3, 3, 2); __PYX_ERR(0, 5052, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "in_any") < 0)) __PYX_ERR(0, 5052, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 3)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
}
__pyx_v_loc = ((PyObject*)values[0]);
__pyx_v_channel = ((PyObject*)values[1]);
__pyx_v_inp = values[2];
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("in_any", 1, 3, 3, __pyx_nargs); __PYX_ERR(0, 5052, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.in_any", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_loc), (&PyInt_Type), 0, "loc", 1))) __PYX_ERR(0, 5052, __pyx_L1_error)
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_channel), (&PyInt_Type), 0, "channel", 1))) __PYX_ERR(0, 5052, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_532in_any(__pyx_self, __pyx_v_loc, __pyx_v_channel, __pyx_v_inp);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_532in_any(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_loc, PyObject *__pyx_v_channel, PyObject *__pyx_v_inp) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8pysndlib_3clm_in_any(__pyx_v_loc, __pyx_v_channel, __pyx_v_inp, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5052, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("pysndlib.clm.in_any", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_tuple__577 = PyTuple_Pack(3, __pyx_n_s_loc, __pyx_n_s_channel, __pyx_n_s_inp); if (unlikely(!__pyx_tuple__577)) __PYX_ERR(0, 5052, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__577);
__Pyx_GIVEREF(__pyx_tuple__577);
/* … */
__pyx_t_43 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 5052, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
if (PyDict_SetItem(__pyx_t_43, __pyx_n_s_loc, __pyx_n_s_int_2) < 0) __PYX_ERR(0, 5052, __pyx_L1_error)
if (PyDict_SetItem(__pyx_t_43, __pyx_n_s_channel, __pyx_n_s_int_2) < 0) __PYX_ERR(0, 5052, __pyx_L1_error)
__pyx_t_37 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_533in_any, 0, __pyx_n_s_in_any, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__578)); if (unlikely(!__pyx_t_37)) __PYX_ERR(0, 5052, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_37);
__Pyx_CyFunction_SetAnnotationsDict(__pyx_t_37, __pyx_t_43);
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
if (PyDict_SetItem(__pyx_d, __pyx_n_s_in_any, __pyx_t_37) < 0) __PYX_ERR(0, 5052, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_37); __pyx_t_37 = 0;
__pyx_codeobj__578 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__577, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_in_any, 5052, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__578)) __PYX_ERR(0, 5052, __pyx_L1_error)
5053: """
5054: input stream sample at loc \in channel chan.
5055:
5056: :param loc: location to read from
5057: :param channel: channel to read from
5058: :param inp: input to read from. can be an appropriately shaped np.ndarray or file2sample
5059: :return: data
5060: :rtype: float
5061: """
+5062: if is_list_or_ndarray(input):
__pyx_t_1 = __pyx_f_8pysndlib_3clm_is_list_or_ndarray(__pyx_builtin_input, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5062, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 5062, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_2) { /* … */ }
+5063: return inp[channel][loc]
__Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_v_inp, __pyx_v_channel); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5063, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_v_loc); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 5063, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_r = __pyx_t_3; __pyx_t_3 = 0; goto __pyx_L0;
+5064: elif isinstance(inp, types.GeneratorType):
__Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_types); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 5064, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_GeneratorType); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5064, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_2 = PyObject_IsInstance(__pyx_v_inp, __pyx_t_1); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 5064, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_2) { /* … */ }
+5065: return next(inp)
__Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyIter_Next(__pyx_v_inp); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5065, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
+5066: elif callable(inp):
__pyx_t_2 = __Pyx_PyCallable_Check(__pyx_v_inp); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 5066, __pyx_L1_error) if (__pyx_t_2) { /* … */ }
+5067: return inp(loc, channel)
__Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_v_inp); __pyx_t_3 = __pyx_v_inp; __pyx_t_4 = NULL; __pyx_t_5 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_3))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); __pyx_t_5 = 1; } } #endif { PyObject *__pyx_callargs[3] = {__pyx_t_4, __pyx_v_loc, __pyx_v_channel}; __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 2+__pyx_t_5); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5067, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
5068: else:
+5069: ipt = <mus_any>inp
/*else*/ {
__pyx_t_1 = __pyx_v_inp;
__Pyx_INCREF(__pyx_t_1);
__pyx_v_ipt = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_t_1);
__pyx_t_1 = 0;
+5070: return cclm.mus_in_any(loc, channel, ipt._ptr)
__Pyx_XDECREF(__pyx_r); __pyx_t_6 = __Pyx_PyInt_As_int64_t(__pyx_v_loc); if (unlikely((__pyx_t_6 == ((mus_long_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 5070, __pyx_L1_error) __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_v_channel); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 5070, __pyx_L1_error) __pyx_t_1 = PyFloat_FromDouble(mus_in_any(__pyx_t_6, __pyx_t_5, __pyx_v_ipt->_ptr)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5070, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; }
5071:
5072: #--------------- ina ----------------#
+5073: cpdef ina(loc: int, inp):
static PyObject *__pyx_pw_8pysndlib_3clm_535ina(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyObject *__pyx_f_8pysndlib_3clm_ina(PyObject *__pyx_v_loc, PyObject *__pyx_v_inp, CYTHON_UNUSED int __pyx_skip_dispatch) {
PyObject *__pyx_r = NULL;
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("pysndlib.clm.ina", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_535ina(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_534ina, "\n input stream sample at loc \\in channel 0.\n \n :param loc: location to read from\n :param inp: input to read from. can be an appropriately shaped np.ndarray or file2sample\n :return: data\n :rtype: float\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_535ina = {"ina", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_535ina, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_534ina};
static PyObject *__pyx_pw_8pysndlib_3clm_535ina(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
PyObject *__pyx_v_loc = 0;
PyObject *__pyx_v_inp = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("ina (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_loc,&__pyx_n_s_inp,0};
PyObject* values[2] = {0,0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_loc)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 5073, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_inp)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 5073, __pyx_L3_error)
else {
__Pyx_RaiseArgtupleInvalid("ina", 1, 2, 2, 1); __PYX_ERR(0, 5073, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "ina") < 0)) __PYX_ERR(0, 5073, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 2)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
}
__pyx_v_loc = ((PyObject*)values[0]);
__pyx_v_inp = values[1];
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("ina", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 5073, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.ina", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_loc), (&PyInt_Type), 0, "loc", 1))) __PYX_ERR(0, 5073, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_534ina(__pyx_self, __pyx_v_loc, __pyx_v_inp);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_534ina(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_loc, PyObject *__pyx_v_inp) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8pysndlib_3clm_ina(__pyx_v_loc, __pyx_v_inp, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5073, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("pysndlib.clm.ina", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_tuple__579 = PyTuple_Pack(2, __pyx_n_s_loc, __pyx_n_s_inp); if (unlikely(!__pyx_tuple__579)) __PYX_ERR(0, 5073, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__579);
__Pyx_GIVEREF(__pyx_tuple__579);
/* … */
__pyx_t_37 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_37)) __PYX_ERR(0, 5073, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_37);
if (PyDict_SetItem(__pyx_t_37, __pyx_n_s_loc, __pyx_n_s_int_2) < 0) __PYX_ERR(0, 5073, __pyx_L1_error)
__pyx_t_43 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_535ina, 0, __pyx_n_s_ina, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__580)); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 5073, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
__Pyx_CyFunction_SetAnnotationsDict(__pyx_t_43, __pyx_t_37);
__Pyx_DECREF(__pyx_t_37); __pyx_t_37 = 0;
if (PyDict_SetItem(__pyx_d, __pyx_n_s_ina, __pyx_t_43) < 0) __PYX_ERR(0, 5073, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
__pyx_codeobj__580 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__579, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_ina, 5073, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__580)) __PYX_ERR(0, 5073, __pyx_L1_error)
5074: """
5075: input stream sample at loc \in channel 0.
5076:
5077: :param loc: location to read from
5078: :param inp: input to read from. can be an appropriately shaped np.ndarray or file2sample
5079: :return: data
5080: :rtype: float
5081: """
+5082: return in_any(loc, 0, inp)
__Pyx_XDECREF(__pyx_r); if (!(likely(__Pyx_Py3Int_CheckExact(__pyx_int_0)) || __Pyx_RaiseUnexpectedTypeError("int", __pyx_int_0))) __PYX_ERR(0, 5082, __pyx_L1_error) __pyx_t_1 = __pyx_f_8pysndlib_3clm_in_any(__pyx_v_loc, ((PyObject*)__pyx_int_0), __pyx_v_inp, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5082, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
5083:
5084: #--------------- inb ----------------#
+5085: cpdef inb(loc: int, inp):
static PyObject *__pyx_pw_8pysndlib_3clm_537inb(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyObject *__pyx_f_8pysndlib_3clm_inb(PyObject *__pyx_v_loc, PyObject *__pyx_v_inp, CYTHON_UNUSED int __pyx_skip_dispatch) {
PyObject *__pyx_r = NULL;
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("pysndlib.clm.inb", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_537inb(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_536inb, "\n input stream sample at loc \\in channel 1.\n \n :param loc: location to read from\n :param channel: channel to read from \n :param inp: input to read from. can be an appropriately shaped np.ndarray or file2sample\n :return: data\n :rtype: float\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_537inb = {"inb", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_537inb, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_536inb};
static PyObject *__pyx_pw_8pysndlib_3clm_537inb(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
PyObject *__pyx_v_loc = 0;
PyObject *__pyx_v_inp = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("inb (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_loc,&__pyx_n_s_inp,0};
PyObject* values[2] = {0,0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_loc)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 5085, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_inp)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 5085, __pyx_L3_error)
else {
__Pyx_RaiseArgtupleInvalid("inb", 1, 2, 2, 1); __PYX_ERR(0, 5085, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "inb") < 0)) __PYX_ERR(0, 5085, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 2)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
}
__pyx_v_loc = ((PyObject*)values[0]);
__pyx_v_inp = values[1];
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("inb", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 5085, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.inb", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_loc), (&PyInt_Type), 0, "loc", 1))) __PYX_ERR(0, 5085, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_536inb(__pyx_self, __pyx_v_loc, __pyx_v_inp);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_536inb(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_loc, PyObject *__pyx_v_inp) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8pysndlib_3clm_inb(__pyx_v_loc, __pyx_v_inp, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5085, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("pysndlib.clm.inb", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_43 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 5085, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
if (PyDict_SetItem(__pyx_t_43, __pyx_n_s_loc, __pyx_n_s_int_2) < 0) __PYX_ERR(0, 5085, __pyx_L1_error)
__pyx_t_37 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_537inb, 0, __pyx_n_s_inb, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__581)); if (unlikely(!__pyx_t_37)) __PYX_ERR(0, 5085, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_37);
__Pyx_CyFunction_SetAnnotationsDict(__pyx_t_37, __pyx_t_43);
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
if (PyDict_SetItem(__pyx_d, __pyx_n_s_inb, __pyx_t_37) < 0) __PYX_ERR(0, 5085, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_37); __pyx_t_37 = 0;
/* … */
__pyx_codeobj__581 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__579, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_inb, 5085, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__581)) __PYX_ERR(0, 5085, __pyx_L1_error)
5086: """
5087: input stream sample at loc \in channel 1.
5088:
5089: :param loc: location to read from
5090: :param channel: channel to read from
5091: :param inp: input to read from. can be an appropriately shaped np.ndarray or file2sample
5092: :return: data
5093: :rtype: float
5094: """
+5095: return in_any(loc, 1, inp)
__Pyx_XDECREF(__pyx_r); if (!(likely(__Pyx_Py3Int_CheckExact(__pyx_int_1)) || __Pyx_RaiseUnexpectedTypeError("int", __pyx_int_1))) __PYX_ERR(0, 5095, __pyx_L1_error) __pyx_t_1 = __pyx_f_8pysndlib_3clm_in_any(__pyx_v_loc, ((PyObject*)__pyx_int_1), __pyx_v_inp, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5095, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
5096:
5097:
5098:
5099: # --------------- locsig ---------------- #
+5100: cpdef mus_any make_locsig(degree: Optional[float]=0.0,
static PyObject *__pyx_pw_8pysndlib_3clm_539make_locsig(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_f_8pysndlib_3clm_make_locsig(CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_8pysndlib_3clm_make_locsig *__pyx_optional_args) {
PyObject *__pyx_v_degree = ((PyObject *)__pyx_float_0_0);
PyObject *__pyx_v_distance = ((PyObject *)__pyx_float_1_);
PyObject *__pyx_v_reverb = ((PyObject *)__pyx_float_0_0);
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_AddTraceback("pysndlib.clm.make_locsig", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XDECREF((PyObject *)__pyx_v_out);
__Pyx_XDECREF((PyObject *)__pyx_v_rout);
__Pyx_XDECREF((PyObject *)__pyx_v_res);
__Pyx_XDECREF(__pyx_v_output);
__Pyx_XDECREF(__pyx_v_revout);
__Pyx_XDECREF(__pyx_v_channels);
__Pyx_XDECREF(__pyx_v_reverb_channels);
__Pyx_XGIVEREF((PyObject *)__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_539make_locsig(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_538make_locsig, "\n return a new generator for signal placement \\in n channels. channel 0 corresponds to 0 degrees.\n \n :param degree: degree to place sound\n :param distance: distance, 1.0 or greater\n :param reverb: reverb amount\n :param output: output to write 'dry' signal to. can be an appropriately shaped np.ndarray or sample2file\n :param revout: output to write 'wet' signal to. can be an appropriately shaped np.ndarray or sample2file\n :param channels: number of main channels\n :param reverb_channels: number of channels for reverb\n :param interp_type: interpolation of position. can be Interp.LINEAR, Interp.SINUSOIDAL\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_539make_locsig = {"make_locsig", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_539make_locsig, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_538make_locsig};
static PyObject *__pyx_pw_8pysndlib_3clm_539make_locsig(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
PyObject *__pyx_v_degree = 0;
PyObject *__pyx_v_distance = 0;
PyObject *__pyx_v_reverb = 0;
PyObject *__pyx_v_output = 0;
PyObject *__pyx_v_revout = 0;
PyObject *__pyx_v_channels = 0;
PyObject *__pyx_v_reverb_channels = 0;
PyObject *__pyx_v_interp_type = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("make_locsig (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_degree,&__pyx_n_s_distance,&__pyx_n_s_reverb,&__pyx_n_s_output,&__pyx_n_s_revout,&__pyx_n_s_channels,&__pyx_n_s_reverb_channels,&__pyx_n_s_interp_type,0};
PyObject* values[8] = {0,0,0,0,0,0,0,0};
values[0] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)__pyx_float_0_0));
values[1] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)__pyx_float_1_));
values[2] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)__pyx_float_0_0));
/* … */
/* function exit code */
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_538make_locsig(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_degree, PyObject *__pyx_v_distance, PyObject *__pyx_v_reverb, PyObject *__pyx_v_output, PyObject *__pyx_v_revout, PyObject *__pyx_v_channels, PyObject *__pyx_v_reverb_channels, PyObject *__pyx_v_interp_type) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_2.__pyx_n = 8;
__pyx_t_2.degree = __pyx_v_degree;
__pyx_t_2.distance = __pyx_v_distance;
__pyx_t_2.reverb = __pyx_v_reverb;
__pyx_t_2.output = __pyx_v_output;
__pyx_t_2.revout = __pyx_v_revout;
__pyx_t_2.channels = __pyx_v_channels;
__pyx_t_2.reverb_channels = __pyx_v_reverb_channels;
__pyx_t_2.interp_type = __pyx_v_interp_type;
__pyx_t_1 = ((PyObject *)__pyx_f_8pysndlib_3clm_make_locsig(0, &__pyx_t_2)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5100, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("pysndlib.clm.make_locsig", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_tuple__582 = PyTuple_Pack(8, __pyx_n_s_degree, __pyx_n_s_distance, __pyx_n_s_reverb, __pyx_n_s_output, __pyx_n_s_revout, __pyx_n_s_channels, __pyx_n_s_reverb_channels, __pyx_n_s_interp_type); if (unlikely(!__pyx_tuple__582)) __PYX_ERR(0, 5100, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__582);
__Pyx_GIVEREF(__pyx_tuple__582);
/* … */
__pyx_t_43 = PyTuple_New(8); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 5100, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
__Pyx_INCREF(__pyx_float_0_0);
__Pyx_GIVEREF(__pyx_float_0_0);
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_43, 0, __pyx_float_0_0)) __PYX_ERR(0, 5100, __pyx_L1_error);
__Pyx_INCREF(__pyx_float_1_);
__Pyx_GIVEREF(__pyx_float_1_);
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_43, 1, __pyx_float_1_)) __PYX_ERR(0, 5100, __pyx_L1_error);
__Pyx_INCREF(__pyx_float_0_0);
__Pyx_GIVEREF(__pyx_float_0_0);
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_43, 2, __pyx_float_0_0)) __PYX_ERR(0, 5100, __pyx_L1_error);
__Pyx_INCREF(Py_None);
__Pyx_GIVEREF(Py_None);
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_43, 3, Py_None)) __PYX_ERR(0, 5100, __pyx_L1_error);
__Pyx_INCREF(Py_None);
__Pyx_GIVEREF(Py_None);
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_43, 4, Py_None)) __PYX_ERR(0, 5100, __pyx_L1_error);
__Pyx_INCREF(Py_None);
__Pyx_GIVEREF(Py_None);
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_43, 5, Py_None)) __PYX_ERR(0, 5100, __pyx_L1_error);
__Pyx_INCREF(Py_None);
__Pyx_GIVEREF(Py_None);
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_43, 6, Py_None)) __PYX_ERR(0, 5100, __pyx_L1_error);
__Pyx_GIVEREF(__pyx_t_37);
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_43, 7, __pyx_t_37)) __PYX_ERR(0, 5100, __pyx_L1_error);
__pyx_t_37 = 0;
__pyx_t_37 = __Pyx_PyDict_NewPresized(8); if (unlikely(!__pyx_t_37)) __PYX_ERR(0, 5100, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_37);
if (PyDict_SetItem(__pyx_t_37, __pyx_n_s_degree, __pyx_kp_s_Optional_float) < 0) __PYX_ERR(0, 5100, __pyx_L1_error)
if (PyDict_SetItem(__pyx_t_37, __pyx_n_s_distance, __pyx_kp_s_Optional_float) < 0) __PYX_ERR(0, 5100, __pyx_L1_error)
if (PyDict_SetItem(__pyx_t_37, __pyx_n_s_reverb, __pyx_kp_s_Optional_float) < 0) __PYX_ERR(0, 5100, __pyx_L1_error)
if (PyDict_SetItem(__pyx_t_37, __pyx_n_s_output, __pyx_kp_s_Optional_mus_any) < 0) __PYX_ERR(0, 5100, __pyx_L1_error)
if (PyDict_SetItem(__pyx_t_37, __pyx_n_s_revout, __pyx_kp_s_Optional_mus_any) < 0) __PYX_ERR(0, 5100, __pyx_L1_error)
if (PyDict_SetItem(__pyx_t_37, __pyx_n_s_channels, __pyx_kp_s_Optional_int) < 0) __PYX_ERR(0, 5100, __pyx_L1_error)
if (PyDict_SetItem(__pyx_t_37, __pyx_n_s_reverb_channels, __pyx_kp_s_Optional_int) < 0) __PYX_ERR(0, 5100, __pyx_L1_error)
if (PyDict_SetItem(__pyx_t_37, __pyx_n_s_interp_type, __pyx_kp_s_Optional_Interp) < 0) __PYX_ERR(0, 5100, __pyx_L1_error)
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_539make_locsig, 0, __pyx_n_s_make_locsig, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__583)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 5100, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
__Pyx_CyFunction_SetDefaultsTuple(__pyx_t_40, __pyx_t_43);
__Pyx_CyFunction_SetAnnotationsDict(__pyx_t_40, __pyx_t_37);
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
__Pyx_DECREF(__pyx_t_37); __pyx_t_37 = 0;
if (PyDict_SetItem(__pyx_d, __pyx_n_s_make_locsig, __pyx_t_40) < 0) __PYX_ERR(0, 5100, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
__pyx_codeobj__583 = (PyObject*)__Pyx_PyCode_New(8, 0, 0, 8, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__582, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_make_locsig, 5100, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__583)) __PYX_ERR(0, 5100, __pyx_L1_error)
/* … */
struct __pyx_opt_args_8pysndlib_3clm_make_locsig {
int __pyx_n;
PyObject *degree;
PyObject *distance;
PyObject *reverb;
PyObject *output;
PyObject *revout;
PyObject *channels;
PyObject *reverb_channels;
PyObject *interp_type;
};
5101: distance: Optional[float]=1.,
5102: reverb: Optional[float]=0.0,
+5103: output: Optional[mus_any]=None,
PyObject *__pyx_v_output = ((PyObject *)Py_None);
/* … */
values[3] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
+5104: revout: Optional[mus_any]=None,
PyObject *__pyx_v_revout = ((PyObject *)Py_None);
/* … */
values[4] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
+5105: channels: Optional[int]=None,
PyObject *__pyx_v_channels = ((PyObject *)Py_None);
/* … */
values[5] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
+5106: reverb_channels: Optional[int]=None,
PyObject *__pyx_v_reverb_channels = ((PyObject *)Py_None);
PyObject *__pyx_v_interp_type = __pyx_k__63;
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_out = NULL;
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_rout = NULL;
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_res = NULL;
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_r = NULL;
if (__pyx_optional_args) {
if (__pyx_optional_args->__pyx_n > 0) {
__pyx_v_degree = __pyx_optional_args->degree;
if (__pyx_optional_args->__pyx_n > 1) {
__pyx_v_distance = __pyx_optional_args->distance;
if (__pyx_optional_args->__pyx_n > 2) {
__pyx_v_reverb = __pyx_optional_args->reverb;
if (__pyx_optional_args->__pyx_n > 3) {
__pyx_v_output = __pyx_optional_args->output;
if (__pyx_optional_args->__pyx_n > 4) {
__pyx_v_revout = __pyx_optional_args->revout;
if (__pyx_optional_args->__pyx_n > 5) {
__pyx_v_channels = __pyx_optional_args->channels;
if (__pyx_optional_args->__pyx_n > 6) {
__pyx_v_reverb_channels = __pyx_optional_args->reverb_channels;
if (__pyx_optional_args->__pyx_n > 7) {
__pyx_v_interp_type = __pyx_optional_args->interp_type;
}
}
}
}
}
}
}
}
}
__Pyx_INCREF(__pyx_v_output);
__Pyx_INCREF(__pyx_v_revout);
__Pyx_INCREF(__pyx_v_channels);
__Pyx_INCREF(__pyx_v_reverb_channels);
/* … */
values[6] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
values[7] = __Pyx_Arg_NewRef_FASTCALL(__pyx_k__63);
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 8: values[7] = __Pyx_Arg_FASTCALL(__pyx_args, 7);
CYTHON_FALLTHROUGH;
case 7: values[6] = __Pyx_Arg_FASTCALL(__pyx_args, 6);
CYTHON_FALLTHROUGH;
case 6: values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5);
CYTHON_FALLTHROUGH;
case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4);
CYTHON_FALLTHROUGH;
case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
CYTHON_FALLTHROUGH;
case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_degree);
if (value) { values[0] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 5100, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 1:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_distance);
if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 5100, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 2:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_reverb);
if (value) { values[2] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 5100, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 3:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_output);
if (value) { values[3] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 5100, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 4:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_revout);
if (value) { values[4] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 5100, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 5:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_channels);
if (value) { values[5] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 5100, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 6:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_reverb_channels);
if (value) { values[6] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 5100, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 7:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_interp_type);
if (value) { values[7] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 5100, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "make_locsig") < 0)) __PYX_ERR(0, 5100, __pyx_L3_error)
}
} else {
switch (__pyx_nargs) {
case 8: values[7] = __Pyx_Arg_FASTCALL(__pyx_args, 7);
CYTHON_FALLTHROUGH;
case 7: values[6] = __Pyx_Arg_FASTCALL(__pyx_args, 6);
CYTHON_FALLTHROUGH;
case 6: values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5);
CYTHON_FALLTHROUGH;
case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4);
CYTHON_FALLTHROUGH;
case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
CYTHON_FALLTHROUGH;
case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
}
__pyx_v_degree = values[0];
__pyx_v_distance = values[1];
__pyx_v_reverb = values[2];
__pyx_v_output = values[3];
__pyx_v_revout = values[4];
__pyx_v_channels = values[5];
__pyx_v_reverb_channels = values[6];
__pyx_v_interp_type = values[7];
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("make_locsig", 0, 0, 8, __pyx_nargs); __PYX_ERR(0, 5100, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.make_locsig", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_8pysndlib_3clm_538make_locsig(__pyx_self, __pyx_v_degree, __pyx_v_distance, __pyx_v_reverb, __pyx_v_output, __pyx_v_revout, __pyx_v_channels, __pyx_v_reverb_channels, __pyx_v_interp_type);
+5107: interp_type: Optional[Interp]=Interp.LINEAR):
__pyx_t_37 = __Pyx_Enum_Interp_to_py(__pyx_e_8pysndlib_3clm_LINEAR); if (unlikely(!__pyx_t_37)) __PYX_ERR(0, 5107, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_37); __pyx_k__63 = __pyx_t_37; __Pyx_GIVEREF(__pyx_t_37); __pyx_t_37 = 0; /* … */ __pyx_t_37 = __Pyx_Enum_Interp_to_py(__pyx_e_8pysndlib_3clm_LINEAR); if (unlikely(!__pyx_t_37)) __PYX_ERR(0, 5107, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_37);
5108:
5109: """
5110: return a new generator for signal placement \in n channels. channel 0 corresponds to 0 degrees.
5111:
5112: :param degree: degree to place sound
5113: :param distance: distance, 1.0 or greater
5114: :param reverb: reverb amount
5115: :param output: output to write 'dry' signal to. can be an appropriately shaped np.ndarray or sample2file
5116: :param revout: output to write 'wet' signal to. can be an appropriately shaped np.ndarray or sample2file
5117: :param channels: number of main channels
5118: :param reverb_channels: number of channels for reverb
5119: :param interp_type: interpolation of position. can be Interp.LINEAR, Interp.SINUSOIDAL
5120: """
5121:
5122: cdef cclm.detour_cb cy_detour_f_ptr
5123:
+5124: if output is None:
__pyx_t_1 = (__pyx_v_output == Py_None);
if (__pyx_t_1) {
/* … */
}
+5125: output = CLM.output #todo : check if this exists
__Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_CLM); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 5125, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_output); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 5125, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF_SET(__pyx_v_output, __pyx_t_3); __pyx_t_3 = 0;
5126:
+5127: if revout is None:
__pyx_t_1 = (__pyx_v_revout == Py_None);
if (__pyx_t_1) {
/* … */
}
+5128: if CLM.reverb is not None:
__Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_CLM); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 5128, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_reverb); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 5128, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_1 = (__pyx_t_2 != Py_None); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__pyx_t_1) { /* … */ goto __pyx_L5; }
+5129: revout = CLM.reverb
__Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_CLM); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 5129, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_reverb); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 5129, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF_SET(__pyx_v_revout, __pyx_t_3); __pyx_t_3 = 0;
5130: else:
+5131: revout = None #this generates and error but still works
/*else*/ {
__Pyx_INCREF(Py_None);
__Pyx_DECREF_SET(__pyx_v_revout, Py_None);
}
__pyx_L5:;
5132:
+5133: if channels is None:
__pyx_t_1 = (__pyx_v_channels == Py_None);
if (__pyx_t_1) {
/* … */
}
+5134: channels = clm_channels(output)
__pyx_t_4 = __pyx_f_8pysndlib_3clm_clm_channels(__pyx_v_output, 0); if (unlikely(__pyx_t_4 == ((long)-1) && PyErr_Occurred())) __PYX_ERR(0, 5134, __pyx_L1_error) __pyx_t_3 = __Pyx_PyInt_From_long(__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 5134, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF_SET(__pyx_v_channels, __pyx_t_3); __pyx_t_3 = 0;
5135:
+5136: if reverb_channels is None:
__pyx_t_1 = (__pyx_v_reverb_channels == Py_None);
if (__pyx_t_1) {
/* … */
}
+5137: if revout is None:
__pyx_t_1 = (__pyx_v_revout == Py_None);
if (__pyx_t_1) {
/* … */
goto __pyx_L8;
}
+5138: reverb_channels = 0
__Pyx_INCREF(__pyx_int_0); __Pyx_DECREF_SET(__pyx_v_reverb_channels, __pyx_int_0);
5139: else:
+5140: reverb_channels = clm_channels(revout)
/*else*/ {
__pyx_t_4 = __pyx_f_8pysndlib_3clm_clm_channels(__pyx_v_revout, 0); if (unlikely(__pyx_t_4 == ((long)-1) && PyErr_Occurred())) __PYX_ERR(0, 5140, __pyx_L1_error)
__pyx_t_3 = __Pyx_PyInt_From_long(__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 5140, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF_SET(__pyx_v_reverb_channels, __pyx_t_3);
__pyx_t_3 = 0;
}
__pyx_L8:;
5141:
+5142: if isinstance(output, mus_any):
__pyx_t_1 = __Pyx_TypeCheck(__pyx_v_output, __pyx_ptype_8pysndlib_3clm_mus_any);
if (__pyx_t_1) {
/* … */
}
5143:
+5144: out = <mus_any>output
__pyx_t_3 = __pyx_v_output;
__Pyx_INCREF(__pyx_t_3);
__pyx_v_out = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_t_3);
__pyx_t_3 = 0;
+5145: rout = <mus_any>revout
__pyx_t_3 = __pyx_v_revout;
__Pyx_INCREF(__pyx_t_3);
__pyx_v_rout = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_t_3);
__pyx_t_3 = 0;
+5146: if revout is not None:
__pyx_t_1 = (__pyx_v_revout != Py_None);
if (__pyx_t_1) {
/* … */
goto __pyx_L10;
}
+5147: res = mus_any.from_ptr(cclm.mus_make_locsig(degree, distance, reverb, channels, out._ptr, reverb_channels, rout._ptr, interp_type))
__pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_v_degree); if (unlikely((__pyx_t_5 == ((mus_float_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 5147, __pyx_L1_error) __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_v_distance); if (unlikely((__pyx_t_6 == ((mus_float_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 5147, __pyx_L1_error) __pyx_t_7 = __pyx_PyFloat_AsDouble(__pyx_v_reverb); if (unlikely((__pyx_t_7 == ((mus_float_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 5147, __pyx_L1_error) __pyx_t_8 = __Pyx_PyInt_As_int(__pyx_v_channels); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 5147, __pyx_L1_error) __pyx_t_9 = __Pyx_PyInt_As_int(__pyx_v_reverb_channels); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 5147, __pyx_L1_error) __pyx_t_10 = ((mus_interp_t)__Pyx_PyInt_As_mus_interp_t(__pyx_v_interp_type)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 5147, __pyx_L1_error) __pyx_t_3 = ((PyObject *)__pyx_vtabptr_8pysndlib_3clm_mus_any->from_ptr(mus_make_locsig(__pyx_t_5, __pyx_t_6, __pyx_t_7, __pyx_t_8, __pyx_v_out->_ptr, __pyx_t_9, __pyx_v_rout->_ptr, __pyx_t_10), NULL)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 5147, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_v_res = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_t_3); __pyx_t_3 = 0;
5148: else:
+5149: res = mus_any.from_ptr(cclm.mus_make_locsig(degree, distance, reverb, channels, out._ptr, reverb_channels, NULL , interp_type))
/*else*/ {
__pyx_t_7 = __pyx_PyFloat_AsDouble(__pyx_v_degree); if (unlikely((__pyx_t_7 == ((mus_float_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 5149, __pyx_L1_error)
__pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_v_distance); if (unlikely((__pyx_t_6 == ((mus_float_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 5149, __pyx_L1_error)
__pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_v_reverb); if (unlikely((__pyx_t_5 == ((mus_float_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 5149, __pyx_L1_error)
__pyx_t_9 = __Pyx_PyInt_As_int(__pyx_v_channels); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 5149, __pyx_L1_error)
__pyx_t_8 = __Pyx_PyInt_As_int(__pyx_v_reverb_channels); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 5149, __pyx_L1_error)
__pyx_t_10 = ((mus_interp_t)__Pyx_PyInt_As_mus_interp_t(__pyx_v_interp_type)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 5149, __pyx_L1_error)
__pyx_t_3 = ((PyObject *)__pyx_vtabptr_8pysndlib_3clm_mus_any->from_ptr(mus_make_locsig(__pyx_t_7, __pyx_t_6, __pyx_t_5, __pyx_t_9, __pyx_v_out->_ptr, __pyx_t_8, NULL, __pyx_t_10), NULL)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 5149, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__pyx_v_res = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_t_3);
__pyx_t_3 = 0;
}
__pyx_L10:;
+5150: return res
__Pyx_XDECREF((PyObject *)__pyx_r); __Pyx_INCREF((PyObject *)__pyx_v_res); __pyx_r = __pyx_v_res; goto __pyx_L0;
5151:
5152: # todo: what if revout is not an iterable? while possible not going to deal with it right now :)
+5153: elif is_list_or_ndarray(output):
__pyx_t_3 = __pyx_f_8pysndlib_3clm_is_list_or_ndarray(__pyx_v_output, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 5153, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 5153, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (likely(__pyx_t_1)) { /* … */ }
+5154: if reverb_channels is None:
__pyx_t_1 = (__pyx_v_reverb_channels == Py_None);
if (__pyx_t_1) {
/* … */
}
+5155: reverb_channels = 0
__Pyx_INCREF(__pyx_int_0); __Pyx_DECREF_SET(__pyx_v_reverb_channels, __pyx_int_0);
5156:
+5157: res = mus_any.from_ptr(cclm.mus_make_locsig(degree, distance, reverb, channels, NULL, reverb_channels, NULL, interp_type))
__pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_v_degree); if (unlikely((__pyx_t_5 == ((mus_float_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 5157, __pyx_L1_error) __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_v_distance); if (unlikely((__pyx_t_6 == ((mus_float_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 5157, __pyx_L1_error) __pyx_t_7 = __pyx_PyFloat_AsDouble(__pyx_v_reverb); if (unlikely((__pyx_t_7 == ((mus_float_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 5157, __pyx_L1_error) __pyx_t_8 = __Pyx_PyInt_As_int(__pyx_v_channels); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 5157, __pyx_L1_error) __pyx_t_9 = __Pyx_PyInt_As_int(__pyx_v_reverb_channels); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 5157, __pyx_L1_error) __pyx_t_10 = ((mus_interp_t)__Pyx_PyInt_As_mus_interp_t(__pyx_v_interp_type)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 5157, __pyx_L1_error) __pyx_t_3 = ((PyObject *)__pyx_vtabptr_8pysndlib_3clm_mus_any->from_ptr(mus_make_locsig(__pyx_t_5, __pyx_t_6, __pyx_t_7, __pyx_t_8, NULL, __pyx_t_9, NULL, __pyx_t_10), NULL)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 5157, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_v_res = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_t_3); __pyx_t_3 = 0;
+5158: cclm.mus_locsig_set_detour(res._ptr, <cclm.detour_cb>locsig_detour_callback_func)
mus_locsig_set_detour(__pyx_v_res->_ptr, ((detour_cb)__pyx_f_8pysndlib_3clm_locsig_detour_callback_func));
5159:
+5160: return res
__Pyx_XDECREF((PyObject *)__pyx_r); __Pyx_INCREF((PyObject *)__pyx_v_res); __pyx_r = __pyx_v_res; goto __pyx_L0;
5161:
5162: else:
+5163: raise TypeError(f"output needs to be a clm gen or np.array not a {type(output)}")
/*else*/ {
__pyx_t_3 = __Pyx_PyObject_FormatSimple(((PyObject *)Py_TYPE(__pyx_v_output)), __pyx_empty_unicode); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 5163, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_2 = __Pyx_PyUnicode_Concat(__pyx_kp_u_output_needs_to_be_a_clm_gen_or, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 5163, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 5163, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_Raise(__pyx_t_3, 0, 0, 0);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__PYX_ERR(0, 5163, __pyx_L1_error)
}
5164:
+5165: cpdef cython.double locsig(gen: mus_any, loc: cython.int, val: cython.double):
static PyObject *__pyx_pw_8pysndlib_3clm_541locsig(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static double __pyx_f_8pysndlib_3clm_locsig(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, int __pyx_v_loc, double __pyx_v_val, CYTHON_UNUSED int __pyx_skip_dispatch) {
double __pyx_r;
/* … */
/* function exit code */
__pyx_r = 0;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_541locsig(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_540locsig, "\n locsig 'gen' channel 'chan' scaler.\n \n :param gen: locsig gen\n :param loc: location to write to \\in samples\n :param val: sample value\n :return: data\n :rtype: float\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_541locsig = {"locsig", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_541locsig, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_540locsig};
static PyObject *__pyx_pw_8pysndlib_3clm_541locsig(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = 0;
int __pyx_v_loc;
double __pyx_v_val;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("locsig (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gen,&__pyx_n_s_loc,&__pyx_n_s_val,0};
PyObject* values[3] = {0,0,0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_gen)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 5165, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_loc)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 5165, __pyx_L3_error)
else {
__Pyx_RaiseArgtupleInvalid("locsig", 1, 3, 3, 1); __PYX_ERR(0, 5165, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 2:
if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_val)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[2]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 5165, __pyx_L3_error)
else {
__Pyx_RaiseArgtupleInvalid("locsig", 1, 3, 3, 2); __PYX_ERR(0, 5165, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "locsig") < 0)) __PYX_ERR(0, 5165, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 3)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
}
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)values[0]);
__pyx_v_loc = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_loc == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 5165, __pyx_L3_error)
__pyx_v_val = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_val == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 5165, __pyx_L3_error)
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("locsig", 1, 3, 3, __pyx_nargs); __PYX_ERR(0, 5165, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.locsig", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gen), __pyx_ptype_8pysndlib_3clm_mus_any, 0, "gen", 0))) __PYX_ERR(0, 5165, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_540locsig(__pyx_self, __pyx_v_gen, __pyx_v_loc, __pyx_v_val);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_540locsig(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, int __pyx_v_loc, double __pyx_v_val) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8pysndlib_3clm_locsig(__pyx_v_gen, __pyx_v_loc, __pyx_v_val, 0); if (unlikely(__pyx_t_1 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 5165, __pyx_L1_error)
__pyx_t_2 = PyFloat_FromDouble(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 5165, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("pysndlib.clm.locsig", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_tuple__584 = PyTuple_Pack(3, __pyx_n_s_gen, __pyx_n_s_loc, __pyx_n_s_val); if (unlikely(!__pyx_tuple__584)) __PYX_ERR(0, 5165, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__584);
__Pyx_GIVEREF(__pyx_tuple__584);
/* … */
__pyx_t_40 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 5165, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
if (PyDict_SetItem(__pyx_t_40, __pyx_n_s_gen, __pyx_n_s_mus_any) < 0) __PYX_ERR(0, 5165, __pyx_L1_error)
if (PyDict_SetItem(__pyx_t_40, __pyx_n_s_loc, __pyx_kp_s_cython_int) < 0) __PYX_ERR(0, 5165, __pyx_L1_error)
if (PyDict_SetItem(__pyx_t_40, __pyx_n_s_val, __pyx_kp_s_cython_double) < 0) __PYX_ERR(0, 5165, __pyx_L1_error)
__pyx_t_37 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_541locsig, 0, __pyx_n_s_locsig, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__585)); if (unlikely(!__pyx_t_37)) __PYX_ERR(0, 5165, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_37);
__Pyx_CyFunction_SetAnnotationsDict(__pyx_t_37, __pyx_t_40);
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
if (PyDict_SetItem(__pyx_d, __pyx_n_s_locsig, __pyx_t_37) < 0) __PYX_ERR(0, 5165, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_37); __pyx_t_37 = 0;
__pyx_codeobj__585 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__584, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_locsig, 5165, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__585)) __PYX_ERR(0, 5165, __pyx_L1_error)
5166: """
5167: locsig 'gen' channel 'chan' scaler.
5168:
5169: :param gen: locsig gen
5170: :param loc: location to write to \in samples
5171: :param val: sample value
5172: :return: data
5173: :rtype: float
5174: """
+5175: cclm.mus_locsig(gen._ptr, loc, val)
mus_locsig(__pyx_v_gen->_ptr, __pyx_v_loc, __pyx_v_val);
5176:
+5177: cpdef bint is_locsig(gen: mus_any):
static PyObject *__pyx_pw_8pysndlib_3clm_543is_locsig(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static int __pyx_f_8pysndlib_3clm_is_locsig(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, CYTHON_UNUSED int __pyx_skip_dispatch) {
int __pyx_r;
/* … */
/* function exit code */
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_543is_locsig(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_542is_locsig, "\n returns True if gen is a locsig.\n \n :param gen: gen\n :return: result\n :rtype: bool\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_543is_locsig = {"is_locsig", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_543is_locsig, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_542is_locsig};
static PyObject *__pyx_pw_8pysndlib_3clm_543is_locsig(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("is_locsig (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gen,0};
PyObject* values[1] = {0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_gen)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 5177, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "is_locsig") < 0)) __PYX_ERR(0, 5177, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 1)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
}
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)values[0]);
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("is_locsig", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 5177, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.is_locsig", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gen), __pyx_ptype_8pysndlib_3clm_mus_any, 0, "gen", 0))) __PYX_ERR(0, 5177, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_542is_locsig(__pyx_self, __pyx_v_gen);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_542is_locsig(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8pysndlib_3clm_is_locsig(__pyx_v_gen, 0); if (unlikely(__pyx_t_1 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 5177, __pyx_L1_error)
__pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 5177, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("pysndlib.clm.is_locsig", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_37 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_37)) __PYX_ERR(0, 5177, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_37);
if (PyDict_SetItem(__pyx_t_37, __pyx_n_s_gen, __pyx_n_s_mus_any) < 0) __PYX_ERR(0, 5177, __pyx_L1_error)
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_543is_locsig, 0, __pyx_n_s_is_locsig, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__586)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 5177, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
__Pyx_CyFunction_SetAnnotationsDict(__pyx_t_40, __pyx_t_37);
__Pyx_DECREF(__pyx_t_37); __pyx_t_37 = 0;
if (PyDict_SetItem(__pyx_d, __pyx_n_s_is_locsig, __pyx_t_40) < 0) __PYX_ERR(0, 5177, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
/* … */
__pyx_codeobj__586 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__56, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_is_locsig, 5177, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__586)) __PYX_ERR(0, 5177, __pyx_L1_error)
5178: """
5179: returns True if gen is a locsig.
5180:
5181: :param gen: gen
5182: :return: result
5183: :rtype: bool
5184: """
+5185: return cclm.mus_is_locsig(gen._ptr)
__pyx_r = mus_is_locsig(__pyx_v_gen->_ptr); goto __pyx_L0;
5186:
+5187: cpdef cython.double locsig_ref(gen: mus_any, chan: int):
static PyObject *__pyx_pw_8pysndlib_3clm_545locsig_ref(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static double __pyx_f_8pysndlib_3clm_locsig_ref(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, PyObject *__pyx_v_chan, CYTHON_UNUSED int __pyx_skip_dispatch) {
double __pyx_r;
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_AddTraceback("pysndlib.clm.locsig_ref", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = -1;
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_545locsig_ref(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_544locsig_ref, "\n get locsig 'gen' channel 'chan' scaler for main output.\n \n :param gen: locsig gen\n :param chan: channel to get\n :return: scaler of chan\n :rtype: float\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_545locsig_ref = {"locsig_ref", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_545locsig_ref, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_544locsig_ref};
static PyObject *__pyx_pw_8pysndlib_3clm_545locsig_ref(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = 0;
PyObject *__pyx_v_chan = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("locsig_ref (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gen,&__pyx_n_s_chan,0};
PyObject* values[2] = {0,0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_gen)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 5187, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_chan)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 5187, __pyx_L3_error)
else {
__Pyx_RaiseArgtupleInvalid("locsig_ref", 1, 2, 2, 1); __PYX_ERR(0, 5187, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "locsig_ref") < 0)) __PYX_ERR(0, 5187, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 2)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
}
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)values[0]);
__pyx_v_chan = ((PyObject*)values[1]);
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("locsig_ref", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 5187, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.locsig_ref", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gen), __pyx_ptype_8pysndlib_3clm_mus_any, 0, "gen", 0))) __PYX_ERR(0, 5187, __pyx_L1_error)
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_chan), (&PyInt_Type), 0, "chan", 1))) __PYX_ERR(0, 5187, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_544locsig_ref(__pyx_self, __pyx_v_gen, __pyx_v_chan);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_544locsig_ref(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, PyObject *__pyx_v_chan) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8pysndlib_3clm_locsig_ref(__pyx_v_gen, __pyx_v_chan, 0); if (unlikely(__pyx_t_1 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 5187, __pyx_L1_error)
__pyx_t_2 = PyFloat_FromDouble(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 5187, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("pysndlib.clm.locsig_ref", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_tuple__587 = PyTuple_Pack(2, __pyx_n_s_gen, __pyx_n_s_chan); if (unlikely(!__pyx_tuple__587)) __PYX_ERR(0, 5187, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__587);
__Pyx_GIVEREF(__pyx_tuple__587);
/* … */
__pyx_t_40 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 5187, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
if (PyDict_SetItem(__pyx_t_40, __pyx_n_s_gen, __pyx_n_s_mus_any) < 0) __PYX_ERR(0, 5187, __pyx_L1_error)
if (PyDict_SetItem(__pyx_t_40, __pyx_n_s_chan, __pyx_n_s_int_2) < 0) __PYX_ERR(0, 5187, __pyx_L1_error)
__pyx_t_37 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_545locsig_ref, 0, __pyx_n_s_locsig_ref, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__588)); if (unlikely(!__pyx_t_37)) __PYX_ERR(0, 5187, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_37);
__Pyx_CyFunction_SetAnnotationsDict(__pyx_t_37, __pyx_t_40);
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
if (PyDict_SetItem(__pyx_d, __pyx_n_s_locsig_ref, __pyx_t_37) < 0) __PYX_ERR(0, 5187, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_37); __pyx_t_37 = 0;
__pyx_codeobj__588 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__587, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_locsig_ref, 5187, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__588)) __PYX_ERR(0, 5187, __pyx_L1_error)
5188: """
5189: get locsig 'gen' channel 'chan' scaler for main output.
5190:
5191: :param gen: locsig gen
5192: :param chan: channel to get
5193: :return: scaler of chan
5194: :rtype: float
5195: """
+5196: return cclm.mus_locsig_ref(gen._ptr, chan)
__pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_chan); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 5196, __pyx_L1_error) __pyx_r = mus_locsig_ref(__pyx_v_gen->_ptr, __pyx_t_1); goto __pyx_L0;
5197:
+5198: cpdef cython.double locsig_set(gen: mus_any, chan: int, val: cython.double):
static PyObject *__pyx_pw_8pysndlib_3clm_547locsig_set(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static double __pyx_f_8pysndlib_3clm_locsig_set(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, PyObject *__pyx_v_chan, double __pyx_v_val, CYTHON_UNUSED int __pyx_skip_dispatch) {
double __pyx_r;
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_AddTraceback("pysndlib.clm.locsig_set", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = -1;
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_547locsig_set(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_546locsig_set, "\n set the locsig generator's channel 'chan' scaler to 'val' for main output.\n \n :param gen: locsig gen\n :param chan: channel to set\n :param val: value to set to\n :return: scaler of chan\n :rtype: float\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_547locsig_set = {"locsig_set", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_547locsig_set, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_546locsig_set};
static PyObject *__pyx_pw_8pysndlib_3clm_547locsig_set(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = 0;
PyObject *__pyx_v_chan = 0;
double __pyx_v_val;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("locsig_set (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gen,&__pyx_n_s_chan,&__pyx_n_s_val,0};
PyObject* values[3] = {0,0,0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_gen)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 5198, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_chan)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 5198, __pyx_L3_error)
else {
__Pyx_RaiseArgtupleInvalid("locsig_set", 1, 3, 3, 1); __PYX_ERR(0, 5198, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 2:
if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_val)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[2]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 5198, __pyx_L3_error)
else {
__Pyx_RaiseArgtupleInvalid("locsig_set", 1, 3, 3, 2); __PYX_ERR(0, 5198, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "locsig_set") < 0)) __PYX_ERR(0, 5198, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 3)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
}
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)values[0]);
__pyx_v_chan = ((PyObject*)values[1]);
__pyx_v_val = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_val == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 5198, __pyx_L3_error)
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("locsig_set", 1, 3, 3, __pyx_nargs); __PYX_ERR(0, 5198, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.locsig_set", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gen), __pyx_ptype_8pysndlib_3clm_mus_any, 0, "gen", 0))) __PYX_ERR(0, 5198, __pyx_L1_error)
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_chan), (&PyInt_Type), 0, "chan", 1))) __PYX_ERR(0, 5198, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_546locsig_set(__pyx_self, __pyx_v_gen, __pyx_v_chan, __pyx_v_val);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_546locsig_set(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, PyObject *__pyx_v_chan, double __pyx_v_val) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8pysndlib_3clm_locsig_set(__pyx_v_gen, __pyx_v_chan, __pyx_v_val, 0); if (unlikely(__pyx_t_1 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 5198, __pyx_L1_error)
__pyx_t_2 = PyFloat_FromDouble(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 5198, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("pysndlib.clm.locsig_set", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_tuple__589 = PyTuple_Pack(3, __pyx_n_s_gen, __pyx_n_s_chan, __pyx_n_s_val); if (unlikely(!__pyx_tuple__589)) __PYX_ERR(0, 5198, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__589);
__Pyx_GIVEREF(__pyx_tuple__589);
/* … */
__pyx_t_37 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_37)) __PYX_ERR(0, 5198, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_37);
if (PyDict_SetItem(__pyx_t_37, __pyx_n_s_gen, __pyx_n_s_mus_any) < 0) __PYX_ERR(0, 5198, __pyx_L1_error)
if (PyDict_SetItem(__pyx_t_37, __pyx_n_s_chan, __pyx_n_s_int_2) < 0) __PYX_ERR(0, 5198, __pyx_L1_error)
if (PyDict_SetItem(__pyx_t_37, __pyx_n_s_val, __pyx_kp_s_cython_double) < 0) __PYX_ERR(0, 5198, __pyx_L1_error)
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_547locsig_set, 0, __pyx_n_s_locsig_set, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__590)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 5198, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
__Pyx_CyFunction_SetAnnotationsDict(__pyx_t_40, __pyx_t_37);
__Pyx_DECREF(__pyx_t_37); __pyx_t_37 = 0;
if (PyDict_SetItem(__pyx_d, __pyx_n_s_locsig_set, __pyx_t_40) < 0) __PYX_ERR(0, 5198, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
__pyx_codeobj__590 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__589, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_locsig_set, 5198, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__590)) __PYX_ERR(0, 5198, __pyx_L1_error)
5199: """
5200: set the locsig generator's channel 'chan' scaler to 'val' for main output.
5201:
5202: :param gen: locsig gen
5203: :param chan: channel to set
5204: :param val: value to set to
5205: :return: scaler of chan
5206: :rtype: float
5207: """
+5208: return cclm.mus_locsig_set(gen._ptr, chan, val)
__pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_chan); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 5208, __pyx_L1_error) __pyx_r = mus_locsig_set(__pyx_v_gen->_ptr, __pyx_t_1, __pyx_v_val); goto __pyx_L0;
5209:
+5210: cpdef cython.double locsig_reverb_ref(gen: mus_any, chan: int):
static PyObject *__pyx_pw_8pysndlib_3clm_549locsig_reverb_ref(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static double __pyx_f_8pysndlib_3clm_locsig_reverb_ref(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, PyObject *__pyx_v_chan, CYTHON_UNUSED int __pyx_skip_dispatch) {
double __pyx_r;
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_AddTraceback("pysndlib.clm.locsig_reverb_ref", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = -1;
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_549locsig_reverb_ref(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_548locsig_reverb_ref, "\n get locsig reverb channel 'chan' scaler.\n \n :param gen: locsig gen\n :param chan: channel to get\n :return: scaler of chan\n :rtype: float\n \n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_549locsig_reverb_ref = {"locsig_reverb_ref", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_549locsig_reverb_ref, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_548locsig_reverb_ref};
static PyObject *__pyx_pw_8pysndlib_3clm_549locsig_reverb_ref(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = 0;
PyObject *__pyx_v_chan = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("locsig_reverb_ref (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gen,&__pyx_n_s_chan,0};
PyObject* values[2] = {0,0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_gen)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 5210, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_chan)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 5210, __pyx_L3_error)
else {
__Pyx_RaiseArgtupleInvalid("locsig_reverb_ref", 1, 2, 2, 1); __PYX_ERR(0, 5210, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "locsig_reverb_ref") < 0)) __PYX_ERR(0, 5210, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 2)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
}
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)values[0]);
__pyx_v_chan = ((PyObject*)values[1]);
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("locsig_reverb_ref", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 5210, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.locsig_reverb_ref", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gen), __pyx_ptype_8pysndlib_3clm_mus_any, 0, "gen", 0))) __PYX_ERR(0, 5210, __pyx_L1_error)
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_chan), (&PyInt_Type), 0, "chan", 1))) __PYX_ERR(0, 5210, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_548locsig_reverb_ref(__pyx_self, __pyx_v_gen, __pyx_v_chan);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_548locsig_reverb_ref(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, PyObject *__pyx_v_chan) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8pysndlib_3clm_locsig_reverb_ref(__pyx_v_gen, __pyx_v_chan, 0); if (unlikely(__pyx_t_1 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 5210, __pyx_L1_error)
__pyx_t_2 = PyFloat_FromDouble(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 5210, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("pysndlib.clm.locsig_reverb_ref", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_40 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 5210, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
if (PyDict_SetItem(__pyx_t_40, __pyx_n_s_gen, __pyx_n_s_mus_any) < 0) __PYX_ERR(0, 5210, __pyx_L1_error)
if (PyDict_SetItem(__pyx_t_40, __pyx_n_s_chan, __pyx_n_s_int_2) < 0) __PYX_ERR(0, 5210, __pyx_L1_error)
__pyx_t_37 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_549locsig_reverb_ref, 0, __pyx_n_s_locsig_reverb_ref, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__591)); if (unlikely(!__pyx_t_37)) __PYX_ERR(0, 5210, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_37);
__Pyx_CyFunction_SetAnnotationsDict(__pyx_t_37, __pyx_t_40);
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
if (PyDict_SetItem(__pyx_d, __pyx_n_s_locsig_reverb_ref, __pyx_t_37) < 0) __PYX_ERR(0, 5210, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_37); __pyx_t_37 = 0;
/* … */
__pyx_codeobj__591 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__587, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_locsig_reverb_ref, 5210, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__591)) __PYX_ERR(0, 5210, __pyx_L1_error)
5211: """
5212: get locsig reverb channel 'chan' scaler.
5213:
5214: :param gen: locsig gen
5215: :param chan: channel to get
5216: :return: scaler of chan
5217: :rtype: float
5218:
5219: """
+5220: return cclm.mus_locsig_reverb_ref(gen._ptr, chan)
__pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_chan); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 5220, __pyx_L1_error) __pyx_r = mus_locsig_reverb_ref(__pyx_v_gen->_ptr, __pyx_t_1); goto __pyx_L0;
5221:
+5222: cpdef cython.double locsig_reverb_set(gen: mus_any, chan: int, val: cython.double):
static PyObject *__pyx_pw_8pysndlib_3clm_551locsig_reverb_set(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static double __pyx_f_8pysndlib_3clm_locsig_reverb_set(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, PyObject *__pyx_v_chan, double __pyx_v_val, CYTHON_UNUSED int __pyx_skip_dispatch) {
double __pyx_r;
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_AddTraceback("pysndlib.clm.locsig_reverb_set", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = -1;
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_551locsig_reverb_set(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_550locsig_reverb_set, "\n set the locsig reverb channel 'chan' scaler to 'val'.\n \n :param gen: locsig gen\n :param chan: channel to set\n :param val: value to set to\n :return: scaler of chan\n :rtype: float\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_551locsig_reverb_set = {"locsig_reverb_set", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_551locsig_reverb_set, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_550locsig_reverb_set};
static PyObject *__pyx_pw_8pysndlib_3clm_551locsig_reverb_set(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = 0;
PyObject *__pyx_v_chan = 0;
double __pyx_v_val;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("locsig_reverb_set (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gen,&__pyx_n_s_chan,&__pyx_n_s_val,0};
PyObject* values[3] = {0,0,0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_gen)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 5222, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_chan)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 5222, __pyx_L3_error)
else {
__Pyx_RaiseArgtupleInvalid("locsig_reverb_set", 1, 3, 3, 1); __PYX_ERR(0, 5222, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 2:
if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_val)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[2]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 5222, __pyx_L3_error)
else {
__Pyx_RaiseArgtupleInvalid("locsig_reverb_set", 1, 3, 3, 2); __PYX_ERR(0, 5222, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "locsig_reverb_set") < 0)) __PYX_ERR(0, 5222, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 3)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
}
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)values[0]);
__pyx_v_chan = ((PyObject*)values[1]);
__pyx_v_val = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_val == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 5222, __pyx_L3_error)
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("locsig_reverb_set", 1, 3, 3, __pyx_nargs); __PYX_ERR(0, 5222, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.locsig_reverb_set", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gen), __pyx_ptype_8pysndlib_3clm_mus_any, 0, "gen", 0))) __PYX_ERR(0, 5222, __pyx_L1_error)
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_chan), (&PyInt_Type), 0, "chan", 1))) __PYX_ERR(0, 5222, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_550locsig_reverb_set(__pyx_self, __pyx_v_gen, __pyx_v_chan, __pyx_v_val);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_550locsig_reverb_set(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, PyObject *__pyx_v_chan, double __pyx_v_val) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8pysndlib_3clm_locsig_reverb_set(__pyx_v_gen, __pyx_v_chan, __pyx_v_val, 0); if (unlikely(__pyx_t_1 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 5222, __pyx_L1_error)
__pyx_t_2 = PyFloat_FromDouble(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 5222, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("pysndlib.clm.locsig_reverb_set", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_37 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_37)) __PYX_ERR(0, 5222, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_37);
if (PyDict_SetItem(__pyx_t_37, __pyx_n_s_gen, __pyx_n_s_mus_any) < 0) __PYX_ERR(0, 5222, __pyx_L1_error)
if (PyDict_SetItem(__pyx_t_37, __pyx_n_s_chan, __pyx_n_s_int_2) < 0) __PYX_ERR(0, 5222, __pyx_L1_error)
if (PyDict_SetItem(__pyx_t_37, __pyx_n_s_val, __pyx_kp_s_cython_double) < 0) __PYX_ERR(0, 5222, __pyx_L1_error)
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_551locsig_reverb_set, 0, __pyx_n_s_locsig_reverb_set, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__592)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 5222, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
__Pyx_CyFunction_SetAnnotationsDict(__pyx_t_40, __pyx_t_37);
__Pyx_DECREF(__pyx_t_37); __pyx_t_37 = 0;
if (PyDict_SetItem(__pyx_d, __pyx_n_s_locsig_reverb_set, __pyx_t_40) < 0) __PYX_ERR(0, 5222, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
/* … */
__pyx_codeobj__592 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__589, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_locsig_reverb_set, 5222, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__592)) __PYX_ERR(0, 5222, __pyx_L1_error)
5223: """
5224: set the locsig reverb channel 'chan' scaler to 'val'.
5225:
5226: :param gen: locsig gen
5227: :param chan: channel to set
5228: :param val: value to set to
5229: :return: scaler of chan
5230: :rtype: float
5231: """
+5232: return cclm.mus_locsig_reverb_set(gen._ptr, chan, val)
__pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_chan); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 5232, __pyx_L1_error) __pyx_r = mus_locsig_reverb_set(__pyx_v_gen->_ptr, __pyx_t_1, __pyx_v_val); goto __pyx_L0;
5233:
+5234: cpdef void move_locsig(gen: mus_any, degree: cython.double, distance: cython.double):
static PyObject *__pyx_pw_8pysndlib_3clm_553move_locsig(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static void __pyx_f_8pysndlib_3clm_move_locsig(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, double __pyx_v_degree, double __pyx_v_distance, CYTHON_UNUSED int __pyx_skip_dispatch) {
/* … */
/* function exit code */
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_553move_locsig(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_552move_locsig, "\n move locsig gen to reflect degree and distance.\n \n :param gen: locsig gen\n :param degree: new degree\n :param distance: new distance\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_553move_locsig = {"move_locsig", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_553move_locsig, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_552move_locsig};
static PyObject *__pyx_pw_8pysndlib_3clm_553move_locsig(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = 0;
double __pyx_v_degree;
double __pyx_v_distance;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("move_locsig (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gen,&__pyx_n_s_degree,&__pyx_n_s_distance,0};
PyObject* values[3] = {0,0,0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_gen)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 5234, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_degree)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 5234, __pyx_L3_error)
else {
__Pyx_RaiseArgtupleInvalid("move_locsig", 1, 3, 3, 1); __PYX_ERR(0, 5234, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 2:
if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_distance)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[2]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 5234, __pyx_L3_error)
else {
__Pyx_RaiseArgtupleInvalid("move_locsig", 1, 3, 3, 2); __PYX_ERR(0, 5234, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "move_locsig") < 0)) __PYX_ERR(0, 5234, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 3)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
}
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)values[0]);
__pyx_v_degree = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_degree == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 5234, __pyx_L3_error)
__pyx_v_distance = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_distance == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 5234, __pyx_L3_error)
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("move_locsig", 1, 3, 3, __pyx_nargs); __PYX_ERR(0, 5234, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.move_locsig", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gen), __pyx_ptype_8pysndlib_3clm_mus_any, 0, "gen", 0))) __PYX_ERR(0, 5234, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_552move_locsig(__pyx_self, __pyx_v_gen, __pyx_v_degree, __pyx_v_distance);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_552move_locsig(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, double __pyx_v_degree, double __pyx_v_distance) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_f_8pysndlib_3clm_move_locsig(__pyx_v_gen, __pyx_v_degree, __pyx_v_distance, 0); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 5234, __pyx_L1_error)
__pyx_t_1 = __Pyx_void_to_None(NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5234, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("pysndlib.clm.move_locsig", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_tuple__593 = PyTuple_Pack(3, __pyx_n_s_gen, __pyx_n_s_degree, __pyx_n_s_distance); if (unlikely(!__pyx_tuple__593)) __PYX_ERR(0, 5234, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__593);
__Pyx_GIVEREF(__pyx_tuple__593);
/* … */
__pyx_t_40 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 5234, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
if (PyDict_SetItem(__pyx_t_40, __pyx_n_s_gen, __pyx_n_s_mus_any) < 0) __PYX_ERR(0, 5234, __pyx_L1_error)
if (PyDict_SetItem(__pyx_t_40, __pyx_n_s_degree, __pyx_kp_s_cython_double) < 0) __PYX_ERR(0, 5234, __pyx_L1_error)
if (PyDict_SetItem(__pyx_t_40, __pyx_n_s_distance, __pyx_kp_s_cython_double) < 0) __PYX_ERR(0, 5234, __pyx_L1_error)
__pyx_t_37 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_553move_locsig, 0, __pyx_n_s_move_locsig, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__594)); if (unlikely(!__pyx_t_37)) __PYX_ERR(0, 5234, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_37);
__Pyx_CyFunction_SetAnnotationsDict(__pyx_t_37, __pyx_t_40);
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
if (PyDict_SetItem(__pyx_d, __pyx_n_s_move_locsig, __pyx_t_37) < 0) __PYX_ERR(0, 5234, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_37); __pyx_t_37 = 0;
__pyx_codeobj__594 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__593, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_move_locsig, 5234, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__594)) __PYX_ERR(0, 5234, __pyx_L1_error)
5235: """
5236: move locsig gen to reflect degree and distance.
5237:
5238: :param gen: locsig gen
5239: :param degree: new degree
5240: :param distance: new distance
5241: """
+5242: cclm.mus_move_locsig(gen._ptr, degree, distance)
mus_move_locsig(__pyx_v_gen->_ptr, __pyx_v_degree, __pyx_v_distance);
5243:
5244:
5245: # added some options . todo: what about sample rate conversion
+5246: cpdef convolve_files(file1: str, file2: str, maxamp: Optional[float]=1., outputfile='test.aif', sample_type=CLM.sample_type, header_type=CLM.header_type):
static PyObject *__pyx_pw_8pysndlib_3clm_555convolve_files(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyObject *__pyx_f_8pysndlib_3clm_convolve_files(PyObject *__pyx_v_file1, PyObject *__pyx_v_file2, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_8pysndlib_3clm_convolve_files *__pyx_optional_args) {
PyObject *__pyx_v_maxamp = ((PyObject *)__pyx_float_1_);
PyObject *__pyx_v_outputfile = ((PyObject *)__pyx_kp_s_test_aif);
PyObject *__pyx_v_sample_type = __pyx_k__64;
PyObject *__pyx_v_header_type = __pyx_k__65;
PyObject *__pyx_v_temp_file = NULL;
long __pyx_v_length;
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_reader = NULL;
long __pyx_v_i;
PyObject *__pyx_r = NULL;
if (__pyx_optional_args) {
if (__pyx_optional_args->__pyx_n > 0) {
__pyx_v_maxamp = __pyx_optional_args->maxamp;
if (__pyx_optional_args->__pyx_n > 1) {
__pyx_v_outputfile = __pyx_optional_args->outputfile;
if (__pyx_optional_args->__pyx_n > 2) {
__pyx_v_sample_type = __pyx_optional_args->sample_type;
if (__pyx_optional_args->__pyx_n > 3) {
__pyx_v_header_type = __pyx_optional_args->header_type;
}
}
}
}
}
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_8);
__Pyx_XDECREF(__pyx_t_10);
__Pyx_AddTraceback("pysndlib.clm.convolve_files", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XDECREF(__pyx_v_temp_file);
__Pyx_XDECREF((PyObject *)__pyx_v_reader);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_555convolve_files(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_554convolve_files, "\n convolve-files handles a very common special case: convolve two files, then normalize the result to some maxamp.\n \n :param file1: first file\n :param file2: second file\n :param maxamp: amp to scale to\n :param outputfile: output file\n :param sample_type: type of sample type to use. defaults to clm.sample_type\n :param header_type: header of sample type to use. defaults to clm.header_type\n :return: output file \n :rtype: str\n ");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_555convolve_files = {"convolve_files", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_555convolve_files, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_554convolve_files};
static PyObject *__pyx_pw_8pysndlib_3clm_555convolve_files(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
PyObject *__pyx_v_file1 = 0;
PyObject *__pyx_v_file2 = 0;
PyObject *__pyx_v_maxamp = 0;
PyObject *__pyx_v_outputfile = 0;
PyObject *__pyx_v_sample_type = 0;
PyObject *__pyx_v_header_type = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("convolve_files (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_file1,&__pyx_n_s_file2,&__pyx_n_s_maxamp_3,&__pyx_n_s_outputfile,&__pyx_n_s_sample_type,&__pyx_n_s_header_type,0};
PyObject* values[6] = {0,0,0,0,0,0};
values[2] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)__pyx_float_1_));
values[3] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)__pyx_kp_s_test_aif));
values[4] = __Pyx_Arg_NewRef_FASTCALL(__pyx_k__64);
values[5] = __Pyx_Arg_NewRef_FASTCALL(__pyx_k__65);
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 6: values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5);
CYTHON_FALLTHROUGH;
case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4);
CYTHON_FALLTHROUGH;
case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
CYTHON_FALLTHROUGH;
case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_file1)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 5246, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_file2)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 5246, __pyx_L3_error)
else {
__Pyx_RaiseArgtupleInvalid("convolve_files", 0, 2, 6, 1); __PYX_ERR(0, 5246, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 2:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_maxamp_3);
if (value) { values[2] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 5246, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 3:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_outputfile);
if (value) { values[3] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 5246, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 4:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_sample_type);
if (value) { values[4] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 5246, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 5:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_header_type);
if (value) { values[5] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 5246, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "convolve_files") < 0)) __PYX_ERR(0, 5246, __pyx_L3_error)
}
} else {
switch (__pyx_nargs) {
case 6: values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5);
CYTHON_FALLTHROUGH;
case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4);
CYTHON_FALLTHROUGH;
case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
CYTHON_FALLTHROUGH;
case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
break;
default: goto __pyx_L5_argtuple_error;
}
}
__pyx_v_file1 = ((PyObject*)values[0]);
__pyx_v_file2 = ((PyObject*)values[1]);
__pyx_v_maxamp = values[2];
__pyx_v_outputfile = values[3];
__pyx_v_sample_type = values[4];
__pyx_v_header_type = values[5];
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("convolve_files", 0, 2, 6, __pyx_nargs); __PYX_ERR(0, 5246, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.convolve_files", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_file1), (&PyString_Type), 0, "file1", 1))) __PYX_ERR(0, 5246, __pyx_L1_error)
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_file2), (&PyString_Type), 0, "file2", 1))) __PYX_ERR(0, 5246, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_554convolve_files(__pyx_self, __pyx_v_file1, __pyx_v_file2, __pyx_v_maxamp, __pyx_v_outputfile, __pyx_v_sample_type, __pyx_v_header_type);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_554convolve_files(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_file1, PyObject *__pyx_v_file2, PyObject *__pyx_v_maxamp, PyObject *__pyx_v_outputfile, PyObject *__pyx_v_sample_type, PyObject *__pyx_v_header_type) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_2.__pyx_n = 4;
__pyx_t_2.maxamp = __pyx_v_maxamp;
__pyx_t_2.outputfile = __pyx_v_outputfile;
__pyx_t_2.sample_type = __pyx_v_sample_type;
__pyx_t_2.header_type = __pyx_v_header_type;
__pyx_t_1 = __pyx_f_8pysndlib_3clm_convolve_files(__pyx_v_file1, __pyx_v_file2, 0, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5246, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("pysndlib.clm.convolve_files", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__Pyx_GetModuleGlobalName(__pyx_t_37, __pyx_n_s_CLM); if (unlikely(!__pyx_t_37)) __PYX_ERR(0, 5246, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_37);
__pyx_t_40 = __Pyx_PyObject_GetAttrStr(__pyx_t_37, __pyx_n_s_sample_type); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 5246, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
__Pyx_DECREF(__pyx_t_37); __pyx_t_37 = 0;
__pyx_k__64 = __pyx_t_40;
__Pyx_GIVEREF(__pyx_t_40);
__pyx_t_40 = 0;
__Pyx_GetModuleGlobalName(__pyx_t_40, __pyx_n_s_CLM); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 5246, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
__pyx_t_37 = __Pyx_PyObject_GetAttrStr(__pyx_t_40, __pyx_n_s_header_type); if (unlikely(!__pyx_t_37)) __PYX_ERR(0, 5246, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_37);
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
__pyx_k__65 = __pyx_t_37;
__Pyx_GIVEREF(__pyx_t_37);
__pyx_t_37 = 0;
/* … */
__pyx_tuple__595 = PyTuple_Pack(6, __pyx_n_s_file1, __pyx_n_s_file2, __pyx_n_s_maxamp_3, __pyx_n_s_outputfile, __pyx_n_s_sample_type, __pyx_n_s_header_type); if (unlikely(!__pyx_tuple__595)) __PYX_ERR(0, 5246, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__595);
__Pyx_GIVEREF(__pyx_tuple__595);
__Pyx_GetModuleGlobalName(__pyx_t_37, __pyx_n_s_CLM); if (unlikely(!__pyx_t_37)) __PYX_ERR(0, 5246, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_37);
__pyx_t_40 = __Pyx_PyObject_GetAttrStr(__pyx_t_37, __pyx_n_s_sample_type); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 5246, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
__Pyx_DECREF(__pyx_t_37); __pyx_t_37 = 0;
__Pyx_GetModuleGlobalName(__pyx_t_37, __pyx_n_s_CLM); if (unlikely(!__pyx_t_37)) __PYX_ERR(0, 5246, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_37);
__pyx_t_43 = __Pyx_PyObject_GetAttrStr(__pyx_t_37, __pyx_n_s_header_type); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 5246, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
__Pyx_DECREF(__pyx_t_37); __pyx_t_37 = 0;
__pyx_t_37 = PyTuple_New(4); if (unlikely(!__pyx_t_37)) __PYX_ERR(0, 5246, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_37);
__Pyx_INCREF(__pyx_float_1_);
__Pyx_GIVEREF(__pyx_float_1_);
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_37, 0, __pyx_float_1_)) __PYX_ERR(0, 5246, __pyx_L1_error);
__Pyx_INCREF(__pyx_kp_s_test_aif);
__Pyx_GIVEREF(__pyx_kp_s_test_aif);
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_37, 1, __pyx_kp_s_test_aif)) __PYX_ERR(0, 5246, __pyx_L1_error);
__Pyx_GIVEREF(__pyx_t_40);
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_37, 2, __pyx_t_40)) __PYX_ERR(0, 5246, __pyx_L1_error);
__Pyx_GIVEREF(__pyx_t_43);
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_37, 3, __pyx_t_43)) __PYX_ERR(0, 5246, __pyx_L1_error);
__pyx_t_40 = 0;
__pyx_t_43 = 0;
__pyx_t_43 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 5246, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
if (PyDict_SetItem(__pyx_t_43, __pyx_n_s_file1, __pyx_n_s_str_2) < 0) __PYX_ERR(0, 5246, __pyx_L1_error)
if (PyDict_SetItem(__pyx_t_43, __pyx_n_s_file2, __pyx_n_s_str_2) < 0) __PYX_ERR(0, 5246, __pyx_L1_error)
if (PyDict_SetItem(__pyx_t_43, __pyx_n_s_maxamp_3, __pyx_kp_s_Optional_float) < 0) __PYX_ERR(0, 5246, __pyx_L1_error)
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_555convolve_files, 0, __pyx_n_s_convolve_files, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__596)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 5246, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
__Pyx_CyFunction_SetDefaultsTuple(__pyx_t_40, __pyx_t_37);
__Pyx_CyFunction_SetAnnotationsDict(__pyx_t_40, __pyx_t_43);
__Pyx_DECREF(__pyx_t_37); __pyx_t_37 = 0;
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
if (PyDict_SetItem(__pyx_d, __pyx_n_s_convolve_files, __pyx_t_40) < 0) __PYX_ERR(0, 5246, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
__pyx_codeobj__596 = (PyObject*)__Pyx_PyCode_New(6, 0, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__595, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_convolve_files, 5246, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__596)) __PYX_ERR(0, 5246, __pyx_L1_error)
/* … */
struct __pyx_opt_args_8pysndlib_3clm_convolve_files {
int __pyx_n;
PyObject *maxamp;
PyObject *outputfile;
PyObject *sample_type;
PyObject *header_type;
};
5247: """
5248: convolve-files handles a very common special case: convolve two files, then normalize the result to some maxamp.
5249:
5250: :param file1: first file
5251: :param file2: second file
5252: :param maxamp: amp to scale to
5253: :param outputfile: output file
5254: :param sample_type: type of sample type to use. defaults to clm.sample_type
5255: :param header_type: header of sample type to use. defaults to clm.header_type
5256: :return: output file
5257: :rtype: str
5258: """
+5259: if header_type == Header.NEXT:
__Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_Header); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5259, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_NEXT); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 5259, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyObject_RichCompare(__pyx_v_header_type, __pyx_t_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5259, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 5259, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_3) { /* … */ goto __pyx_L3; }
+5260: cclm.mus_convolve_files(file1, file2, maxamp,outputfile)
__pyx_t_4 = __Pyx_PyObject_AsString(__pyx_v_file1); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 5260, __pyx_L1_error) __pyx_t_5 = __Pyx_PyObject_AsString(__pyx_v_file2); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) __PYX_ERR(0, 5260, __pyx_L1_error) __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_v_maxamp); if (unlikely((__pyx_t_6 == ((mus_float_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 5260, __pyx_L1_error) __pyx_t_7 = __Pyx_PyObject_AsString(__pyx_v_outputfile); if (unlikely((!__pyx_t_7) && PyErr_Occurred())) __PYX_ERR(0, 5260, __pyx_L1_error) mus_convolve_files(__pyx_t_4, __pyx_t_5, __pyx_t_6, __pyx_t_7);
5261: else:
+5262: temp_file = tempfile.gettempdir() + '/' + 'temp-' + outputfile
/*else*/ {
__Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_tempfile); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 5262, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_gettempdir); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 5262, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_8);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_t_2 = NULL;
__pyx_t_9 = 0;
#if CYTHON_UNPACK_METHODS
if (unlikely(PyMethod_Check(__pyx_t_8))) {
__pyx_t_2 = PyMethod_GET_SELF(__pyx_t_8);
if (likely(__pyx_t_2)) {
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
__Pyx_INCREF(__pyx_t_2);
__Pyx_INCREF(function);
__Pyx_DECREF_SET(__pyx_t_8, function);
__pyx_t_9 = 1;
}
}
#endif
{
PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
__pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_8, __pyx_callargs+1-__pyx_t_9, 0+__pyx_t_9);
__Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5262, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
}
__pyx_t_8 = PyNumber_Add(__pyx_t_1, __pyx_kp_s__66); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 5262, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_8);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_t_1 = PyNumber_Add(__pyx_t_8, __pyx_kp_s_temp); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5262, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
__pyx_t_8 = PyNumber_Add(__pyx_t_1, __pyx_v_outputfile); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 5262, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_8);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_v_temp_file = __pyx_t_8;
__pyx_t_8 = 0;
+5263: cclm.mus_convolve_files(file1, file2, maxamp, temp_file)
__pyx_t_4 = __Pyx_PyObject_AsString(__pyx_v_file1); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 5263, __pyx_L1_error) __pyx_t_5 = __Pyx_PyObject_AsString(__pyx_v_file2); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) __PYX_ERR(0, 5263, __pyx_L1_error) __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_v_maxamp); if (unlikely((__pyx_t_6 == ((mus_float_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 5263, __pyx_L1_error) __pyx_t_7 = __Pyx_PyObject_AsString(__pyx_v_temp_file); if (unlikely((!__pyx_t_7) && PyErr_Occurred())) __PYX_ERR(0, 5263, __pyx_L1_error) mus_convolve_files(__pyx_t_4, __pyx_t_5, __pyx_t_6, __pyx_t_7);
+5264: with Sound(outputfile, header_type=header_type, sample_type=sample_type):
/*with:*/ {
__Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_Sound); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 5264, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_8);
__pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5264, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__Pyx_INCREF(__pyx_v_outputfile);
__Pyx_GIVEREF(__pyx_v_outputfile);
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_outputfile)) __PYX_ERR(0, 5264, __pyx_L1_error);
__pyx_t_2 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 5264, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_header_type, __pyx_v_header_type) < 0) __PYX_ERR(0, 5264, __pyx_L1_error)
if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_sample_type, __pyx_v_sample_type) < 0) __PYX_ERR(0, 5264, __pyx_L1_error)
__pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 5264, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_10);
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_t_11 = __Pyx_PyObject_LookupSpecial(__pyx_t_10, __pyx_n_s_exit); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 5264, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_11);
__pyx_t_1 = __Pyx_PyObject_LookupSpecial(__pyx_t_10, __pyx_n_s_enter); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5264, __pyx_L4_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_8 = NULL;
__pyx_t_9 = 0;
#if CYTHON_UNPACK_METHODS
if (likely(PyMethod_Check(__pyx_t_1))) {
__pyx_t_8 = PyMethod_GET_SELF(__pyx_t_1);
if (likely(__pyx_t_8)) {
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
__Pyx_INCREF(__pyx_t_8);
__Pyx_INCREF(function);
__Pyx_DECREF_SET(__pyx_t_1, function);
__pyx_t_9 = 1;
}
}
#endif
{
PyObject *__pyx_callargs[2] = {__pyx_t_8, NULL};
__pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_1, __pyx_callargs+1-__pyx_t_9, 0+__pyx_t_9);
__Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 5264, __pyx_L4_error)
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
}
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
/*try:*/ {
{
/*try:*/ {
/* … */
}
__Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
__Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
__Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
goto __pyx_L13_try_end;
__pyx_L8_error:;
__Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
__Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
/*except:*/ {
__Pyx_AddTraceback("pysndlib.clm.convolve_files", __pyx_clineno, __pyx_lineno, __pyx_filename);
if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_10, &__pyx_t_1) < 0) __PYX_ERR(0, 5264, __pyx_L10_except_error)
__Pyx_XGOTREF(__pyx_t_2);
__Pyx_XGOTREF(__pyx_t_10);
__Pyx_XGOTREF(__pyx_t_1);
__pyx_t_8 = PyTuple_Pack(3, __pyx_t_2, __pyx_t_10, __pyx_t_1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 5264, __pyx_L10_except_error)
__Pyx_GOTREF(__pyx_t_8);
__pyx_t_20 = __Pyx_PyObject_Call(__pyx_t_11, __pyx_t_8, NULL);
__Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 5264, __pyx_L10_except_error)
__Pyx_GOTREF(__pyx_t_20);
__pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_20);
__Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
if (__pyx_t_3 < 0) __PYX_ERR(0, 5264, __pyx_L10_except_error)
__pyx_t_21 = (!__pyx_t_3);
if (unlikely(__pyx_t_21)) {
__Pyx_GIVEREF(__pyx_t_2);
__Pyx_GIVEREF(__pyx_t_10);
__Pyx_XGIVEREF(__pyx_t_1);
__Pyx_ErrRestoreWithState(__pyx_t_2, __pyx_t_10, __pyx_t_1);
__pyx_t_2 = 0; __pyx_t_10 = 0; __pyx_t_1 = 0;
__PYX_ERR(0, 5264, __pyx_L10_except_error)
}
__Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
__Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
goto __pyx_L9_exception_handled;
}
__pyx_L10_except_error:;
__Pyx_XGIVEREF(__pyx_t_12);
__Pyx_XGIVEREF(__pyx_t_13);
__Pyx_XGIVEREF(__pyx_t_14);
__Pyx_ExceptionReset(__pyx_t_12, __pyx_t_13, __pyx_t_14);
goto __pyx_L1_error;
__pyx_L9_exception_handled:;
__Pyx_XGIVEREF(__pyx_t_12);
__Pyx_XGIVEREF(__pyx_t_13);
__Pyx_XGIVEREF(__pyx_t_14);
__Pyx_ExceptionReset(__pyx_t_12, __pyx_t_13, __pyx_t_14);
__pyx_L13_try_end:;
}
}
/*finally:*/ {
/*normal exit:*/{
if (__pyx_t_11) {
__pyx_t_14 = __Pyx_PyObject_Call(__pyx_t_11, __pyx_tuple__67, NULL);
__Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 5264, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_14);
__Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
}
goto __pyx_L7;
}
__pyx_L7:;
}
goto __pyx_L19;
__pyx_L4_error:;
__Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
goto __pyx_L1_error;
__pyx_L19:;
}
}
__pyx_L3:;
/* … */
__pyx_tuple__67 = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_tuple__67)) __PYX_ERR(0, 5264, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__67);
__Pyx_GIVEREF(__pyx_tuple__67);
+5265: length = seconds2samples(csndlib.mus_sound_duration(temp_file))
__pyx_t_15 = __Pyx_PyObject_AsString(__pyx_v_temp_file); if (unlikely((!__pyx_t_15) && PyErr_Occurred())) __PYX_ERR(0, 5265, __pyx_L8_error) __pyx_t_16 = __pyx_f_8pysndlib_3clm_seconds2samples(mus_sound_duration(__pyx_t_15), 0); if (unlikely(__pyx_t_16 == ((long)-1) && PyErr_Occurred())) __PYX_ERR(0, 5265, __pyx_L8_error) __pyx_v_length = __pyx_t_16;
+5266: reader = make_readin(temp_file)
if (!(likely(PyString_CheckExact(__pyx_v_temp_file))||((__pyx_v_temp_file) == Py_None) || __Pyx_RaiseUnexpectedTypeError("str", __pyx_v_temp_file))) __PYX_ERR(0, 5266, __pyx_L8_error) __pyx_t_10 = ((PyObject *)__pyx_f_8pysndlib_3clm_make_readin(((PyObject*)__pyx_v_temp_file), 0, NULL)); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 5266, __pyx_L8_error) __Pyx_GOTREF(__pyx_t_10); __pyx_v_reader = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_t_10); __pyx_t_10 = 0;
+5267: for i in range(0, length):
__pyx_t_16 = __pyx_v_length;
__pyx_t_17 = __pyx_t_16;
for (__pyx_t_18 = 0; __pyx_t_18 < __pyx_t_17; __pyx_t_18+=1) {
__pyx_v_i = __pyx_t_18;
+5268: outa(i, readin(reader))
__pyx_t_10 = __Pyx_PyInt_From_long(__pyx_v_i); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 5268, __pyx_L8_error) __Pyx_GOTREF(__pyx_t_10); if (!(likely(__Pyx_Py3Int_CheckExact(__pyx_t_10)) || __Pyx_RaiseUnexpectedTypeError("int", __pyx_t_10))) __PYX_ERR(0, 5268, __pyx_L8_error) __pyx_t_19 = __pyx_f_8pysndlib_3clm_readin(__pyx_v_reader, 0); if (unlikely(__pyx_t_19 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 5268, __pyx_L8_error) __pyx_t_2 = __pyx_f_8pysndlib_3clm_outa(((PyObject*)__pyx_t_10), __pyx_t_19, 0, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 5268, __pyx_L8_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; }
+5269: return outputfile
__Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_v_outputfile); __pyx_r = __pyx_v_outputfile; goto __pyx_L0;
5270:
5271:
5272: # --------------- additions ---------------- #
5273:
5274:
5275:
5276:
5277: # --------------- dcblock ---------------- #
5278:
+5279: cpdef mus_any make_dcblock():
static PyObject *__pyx_pw_8pysndlib_3clm_557make_dcblock(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_f_8pysndlib_3clm_make_dcblock(CYTHON_UNUSED int __pyx_skip_dispatch) {
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_r = NULL;
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_AddTraceback("pysndlib.clm.make_dcblock", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XGIVEREF((PyObject *)__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_557make_dcblock(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyMethodDef __pyx_mdef_8pysndlib_3clm_557make_dcblock = {"make_dcblock", (PyCFunction)__pyx_pw_8pysndlib_3clm_557make_dcblock, METH_NOARGS, 0};
static PyObject *__pyx_pw_8pysndlib_3clm_557make_dcblock(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("make_dcblock (wrapper)", 0);
__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
__pyx_r = __pyx_pf_8pysndlib_3clm_556make_dcblock(__pyx_self);
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_556make_dcblock(CYTHON_UNUSED PyObject *__pyx_self) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = ((PyObject *)__pyx_f_8pysndlib_3clm_make_dcblock(0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5279, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("pysndlib.clm.make_dcblock", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_557make_dcblock, 0, __pyx_n_s_make_dcblock, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__597)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 5279, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_make_dcblock, __pyx_t_40) < 0) __PYX_ERR(0, 5279, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
/* … */
__pyx_codeobj__597 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_make_dcblock, 5279, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__597)) __PYX_ERR(0, 5279, __pyx_L1_error)
+5280: return make_filter(2, [1,-1], [0, -.99])
__Pyx_XDECREF((PyObject *)__pyx_r); __pyx_t_1 = PyList_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5280, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_int_1); __Pyx_GIVEREF(__pyx_int_1); if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 0, __pyx_int_1)) __PYX_ERR(0, 5280, __pyx_L1_error); __Pyx_INCREF(__pyx_int_neg_1); __Pyx_GIVEREF(__pyx_int_neg_1); if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 1, __pyx_int_neg_1)) __PYX_ERR(0, 5280, __pyx_L1_error); __pyx_t_2 = PyList_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 5280, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_int_0); __Pyx_GIVEREF(__pyx_int_0); if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 0, __pyx_int_0)) __PYX_ERR(0, 5280, __pyx_L1_error); __Pyx_INCREF(__pyx_float_neg__99); __Pyx_GIVEREF(__pyx_float_neg__99); if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 1, __pyx_float_neg__99)) __PYX_ERR(0, 5280, __pyx_L1_error); __pyx_t_3 = ((PyObject *)__pyx_f_8pysndlib_3clm_make_filter(2, __pyx_t_1, __pyx_t_2, 0)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 5280, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_t_3); __pyx_t_3 = 0; goto __pyx_L0;
5281:
+5282: cpdef cython.double dcblock(gen: mus_any, insig: cython.double):
static PyObject *__pyx_pw_8pysndlib_3clm_559dcblock(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static double __pyx_f_8pysndlib_3clm_dcblock(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, double __pyx_v_insig, CYTHON_UNUSED int __pyx_skip_dispatch) {
double __pyx_r;
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_AddTraceback("pysndlib.clm.dcblock", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = -1;
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_559dcblock(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_8pysndlib_3clm_559dcblock = {"dcblock", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_559dcblock, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_8pysndlib_3clm_559dcblock(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = 0;
double __pyx_v_insig;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("dcblock (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gen,&__pyx_n_s_insig,0};
PyObject* values[2] = {0,0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_gen)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 5282, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_insig)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 5282, __pyx_L3_error)
else {
__Pyx_RaiseArgtupleInvalid("dcblock", 1, 2, 2, 1); __PYX_ERR(0, 5282, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "dcblock") < 0)) __PYX_ERR(0, 5282, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 2)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
}
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)values[0]);
__pyx_v_insig = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_insig == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 5282, __pyx_L3_error)
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("dcblock", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 5282, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.dcblock", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gen), __pyx_ptype_8pysndlib_3clm_mus_any, 0, "gen", 0))) __PYX_ERR(0, 5282, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_558dcblock(__pyx_self, __pyx_v_gen, __pyx_v_insig);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_558dcblock(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, double __pyx_v_insig) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8pysndlib_3clm_dcblock(__pyx_v_gen, __pyx_v_insig, 0); if (unlikely(__pyx_t_1 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 5282, __pyx_L1_error)
__pyx_t_2 = PyFloat_FromDouble(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 5282, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("pysndlib.clm.dcblock", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_40 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 5282, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
if (PyDict_SetItem(__pyx_t_40, __pyx_n_s_gen, __pyx_n_s_mus_any) < 0) __PYX_ERR(0, 5282, __pyx_L1_error)
if (PyDict_SetItem(__pyx_t_40, __pyx_n_s_insig, __pyx_kp_s_cython_double) < 0) __PYX_ERR(0, 5282, __pyx_L1_error)
__pyx_t_43 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_559dcblock, 0, __pyx_n_s_dcblock, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__598)); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 5282, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
__Pyx_CyFunction_SetAnnotationsDict(__pyx_t_43, __pyx_t_40);
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
if (PyDict_SetItem(__pyx_d, __pyx_n_s_dcblock, __pyx_t_43) < 0) __PYX_ERR(0, 5282, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
/* … */
__pyx_codeobj__598 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__380, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_dcblock, 5282, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__598)) __PYX_ERR(0, 5282, __pyx_L1_error)
+5283: return filter(gen, insig)
__pyx_t_1 = __pyx_f_8pysndlib_3clm_filter(__pyx_v_gen, __pyx_v_insig, 0); if (unlikely(__pyx_t_1 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 5283, __pyx_L1_error) __pyx_r = __pyx_t_1; goto __pyx_L0;
5284:
5285:
5286: # --------------- biquad ---------------- #
5287:
+5288: cpdef mus_any make_biquad(a0: cython.double,a1: cython.double,a2: cython.double,b1: cython.double,b2: cython.double):
static PyObject *__pyx_pw_8pysndlib_3clm_561make_biquad(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_f_8pysndlib_3clm_make_biquad(double __pyx_v_a0, double __pyx_v_a1, double __pyx_v_a2, double __pyx_v_b1, double __pyx_v_b2, CYTHON_UNUSED int __pyx_skip_dispatch) {
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_r = NULL;
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_XDECREF(__pyx_t_5);
__Pyx_XDECREF(__pyx_t_6);
__Pyx_AddTraceback("pysndlib.clm.make_biquad", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XGIVEREF((PyObject *)__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_561make_biquad(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_8pysndlib_3clm_560make_biquad, "returns a biquad filter (use with the CLM filter gen)");
static PyMethodDef __pyx_mdef_8pysndlib_3clm_561make_biquad = {"make_biquad", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_561make_biquad, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pysndlib_3clm_560make_biquad};
static PyObject *__pyx_pw_8pysndlib_3clm_561make_biquad(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
double __pyx_v_a0;
double __pyx_v_a1;
double __pyx_v_a2;
double __pyx_v_b1;
double __pyx_v_b2;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("make_biquad (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_a0,&__pyx_n_s_a1,&__pyx_n_s_a2,&__pyx_n_s_b1,&__pyx_n_s_b2,0};
PyObject* values[5] = {0,0,0,0,0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4);
CYTHON_FALLTHROUGH;
case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
CYTHON_FALLTHROUGH;
case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_a0)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 5288, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_a1)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 5288, __pyx_L3_error)
else {
__Pyx_RaiseArgtupleInvalid("make_biquad", 1, 5, 5, 1); __PYX_ERR(0, 5288, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 2:
if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_a2)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[2]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 5288, __pyx_L3_error)
else {
__Pyx_RaiseArgtupleInvalid("make_biquad", 1, 5, 5, 2); __PYX_ERR(0, 5288, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 3:
if (likely((values[3] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_b1)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[3]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 5288, __pyx_L3_error)
else {
__Pyx_RaiseArgtupleInvalid("make_biquad", 1, 5, 5, 3); __PYX_ERR(0, 5288, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 4:
if (likely((values[4] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_b2)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[4]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 5288, __pyx_L3_error)
else {
__Pyx_RaiseArgtupleInvalid("make_biquad", 1, 5, 5, 4); __PYX_ERR(0, 5288, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "make_biquad") < 0)) __PYX_ERR(0, 5288, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 5)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4);
}
__pyx_v_a0 = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_a0 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 5288, __pyx_L3_error)
__pyx_v_a1 = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_a1 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 5288, __pyx_L3_error)
__pyx_v_a2 = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_a2 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 5288, __pyx_L3_error)
__pyx_v_b1 = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_b1 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 5288, __pyx_L3_error)
__pyx_v_b2 = __pyx_PyFloat_AsDouble(values[4]); if (unlikely((__pyx_v_b2 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 5288, __pyx_L3_error)
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("make_biquad", 1, 5, 5, __pyx_nargs); __PYX_ERR(0, 5288, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.make_biquad", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_8pysndlib_3clm_560make_biquad(__pyx_self, __pyx_v_a0, __pyx_v_a1, __pyx_v_a2, __pyx_v_b1, __pyx_v_b2);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_560make_biquad(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_a0, double __pyx_v_a1, double __pyx_v_a2, double __pyx_v_b1, double __pyx_v_b2) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = ((PyObject *)__pyx_f_8pysndlib_3clm_make_biquad(__pyx_v_a0, __pyx_v_a1, __pyx_v_a2, __pyx_v_b1, __pyx_v_b2, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5288, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("pysndlib.clm.make_biquad", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_tuple__599 = PyTuple_Pack(5, __pyx_n_s_a0, __pyx_n_s_a1, __pyx_n_s_a2, __pyx_n_s_b1, __pyx_n_s_b2); if (unlikely(!__pyx_tuple__599)) __PYX_ERR(0, 5288, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__599);
__Pyx_GIVEREF(__pyx_tuple__599);
/* … */
__pyx_t_43 = __Pyx_PyDict_NewPresized(5); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 5288, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
if (PyDict_SetItem(__pyx_t_43, __pyx_n_s_a0, __pyx_kp_s_cython_double) < 0) __PYX_ERR(0, 5288, __pyx_L1_error)
if (PyDict_SetItem(__pyx_t_43, __pyx_n_s_a1, __pyx_kp_s_cython_double) < 0) __PYX_ERR(0, 5288, __pyx_L1_error)
if (PyDict_SetItem(__pyx_t_43, __pyx_n_s_a2, __pyx_kp_s_cython_double) < 0) __PYX_ERR(0, 5288, __pyx_L1_error)
if (PyDict_SetItem(__pyx_t_43, __pyx_n_s_b1, __pyx_kp_s_cython_double) < 0) __PYX_ERR(0, 5288, __pyx_L1_error)
if (PyDict_SetItem(__pyx_t_43, __pyx_n_s_b2, __pyx_kp_s_cython_double) < 0) __PYX_ERR(0, 5288, __pyx_L1_error)
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_561make_biquad, 0, __pyx_n_s_make_biquad, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__600)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 5288, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
__Pyx_CyFunction_SetAnnotationsDict(__pyx_t_40, __pyx_t_43);
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
if (PyDict_SetItem(__pyx_d, __pyx_n_s_make_biquad, __pyx_t_40) < 0) __PYX_ERR(0, 5288, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
__pyx_codeobj__600 = (PyObject*)__Pyx_PyCode_New(5, 0, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__599, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_make_biquad, 5288, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__600)) __PYX_ERR(0, 5288, __pyx_L1_error)
5289: """returns a biquad filter (use with the CLM filter gen)"""
+5290: return make_filter(3, np.array([a0,a1,a2]), np.array([0.0,b1,b2]))
__Pyx_XDECREF((PyObject *)__pyx_r); __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 5290, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_array); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 5290, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = PyFloat_FromDouble(__pyx_v_a0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 5290, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_4 = PyFloat_FromDouble(__pyx_v_a1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 5290, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = PyFloat_FromDouble(__pyx_v_a2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 5290, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_6 = PyList_New(3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 5290, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_GIVEREF(__pyx_t_2); if (__Pyx_PyList_SET_ITEM(__pyx_t_6, 0, __pyx_t_2)) __PYX_ERR(0, 5290, __pyx_L1_error); __Pyx_GIVEREF(__pyx_t_4); if (__Pyx_PyList_SET_ITEM(__pyx_t_6, 1, __pyx_t_4)) __PYX_ERR(0, 5290, __pyx_L1_error); __Pyx_GIVEREF(__pyx_t_5); if (__Pyx_PyList_SET_ITEM(__pyx_t_6, 2, __pyx_t_5)) __PYX_ERR(0, 5290, __pyx_L1_error); __pyx_t_2 = 0; __pyx_t_4 = 0; __pyx_t_5 = 0; __pyx_t_5 = NULL; __pyx_t_7 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_3))) { __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_5)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_5); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); __pyx_t_7 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_t_6}; __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7); __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5290, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 5290, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_array); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 5290, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_6 = PyFloat_FromDouble(__pyx_v_b1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 5290, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_4 = PyFloat_FromDouble(__pyx_v_b2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 5290, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_2 = PyList_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 5290, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_float_0_0); __Pyx_GIVEREF(__pyx_float_0_0); if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 0, __pyx_float_0_0)) __PYX_ERR(0, 5290, __pyx_L1_error); __Pyx_GIVEREF(__pyx_t_6); if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 1, __pyx_t_6)) __PYX_ERR(0, 5290, __pyx_L1_error); __Pyx_GIVEREF(__pyx_t_4); if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 2, __pyx_t_4)) __PYX_ERR(0, 5290, __pyx_L1_error); __pyx_t_6 = 0; __pyx_t_4 = 0; __pyx_t_4 = NULL; __pyx_t_7 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_5))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_5, function); __pyx_t_7 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_2}; __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 5290, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } __pyx_t_5 = ((PyObject *)__pyx_f_8pysndlib_3clm_make_filter(3, __pyx_t_1, __pyx_t_3, 0)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 5290, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_r = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_t_5); __pyx_t_5 = 0; goto __pyx_L0;
5291:
+5292: cpdef cython.double biquad(gen: mus_any, insig: cython.double,):
static PyObject *__pyx_pw_8pysndlib_3clm_563biquad(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static double __pyx_f_8pysndlib_3clm_biquad(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, double __pyx_v_insig, CYTHON_UNUSED int __pyx_skip_dispatch) {
double __pyx_r;
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_AddTraceback("pysndlib.clm.biquad", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = -1;
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_563biquad(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_8pysndlib_3clm_563biquad = {"biquad", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_563biquad, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_8pysndlib_3clm_563biquad(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = 0;
double __pyx_v_insig;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("biquad (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gen,&__pyx_n_s_insig,0};
PyObject* values[2] = {0,0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_gen)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 5292, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_insig)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 5292, __pyx_L3_error)
else {
__Pyx_RaiseArgtupleInvalid("biquad", 1, 2, 2, 1); __PYX_ERR(0, 5292, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "biquad") < 0)) __PYX_ERR(0, 5292, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 2)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
}
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)values[0]);
__pyx_v_insig = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_insig == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 5292, __pyx_L3_error)
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("biquad", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 5292, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.biquad", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gen), __pyx_ptype_8pysndlib_3clm_mus_any, 0, "gen", 0))) __PYX_ERR(0, 5292, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_562biquad(__pyx_self, __pyx_v_gen, __pyx_v_insig);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_562biquad(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, double __pyx_v_insig) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8pysndlib_3clm_biquad(__pyx_v_gen, __pyx_v_insig, 0); if (unlikely(__pyx_t_1 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 5292, __pyx_L1_error)
__pyx_t_2 = PyFloat_FromDouble(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 5292, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("pysndlib.clm.biquad", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_40 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 5292, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
if (PyDict_SetItem(__pyx_t_40, __pyx_n_s_gen, __pyx_n_s_mus_any) < 0) __PYX_ERR(0, 5292, __pyx_L1_error)
if (PyDict_SetItem(__pyx_t_40, __pyx_n_s_insig, __pyx_kp_s_cython_double) < 0) __PYX_ERR(0, 5292, __pyx_L1_error)
__pyx_t_43 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_563biquad, 0, __pyx_n_s_biquad, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__601)); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 5292, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
__Pyx_CyFunction_SetAnnotationsDict(__pyx_t_43, __pyx_t_40);
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
if (PyDict_SetItem(__pyx_d, __pyx_n_s_biquad, __pyx_t_43) < 0) __PYX_ERR(0, 5292, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
/* … */
__pyx_codeobj__601 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__380, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_biquad, 5292, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__601)) __PYX_ERR(0, 5292, __pyx_L1_error)
+5293: return filter(gen, insig)
__pyx_t_1 = __pyx_f_8pysndlib_3clm_filter(__pyx_v_gen, __pyx_v_insig, 0); if (unlikely(__pyx_t_1 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 5293, __pyx_L1_error) __pyx_r = __pyx_t_1; goto __pyx_L0;
5294:
+5295: cpdef bint is_biquad(gen: mus_any):
static PyObject *__pyx_pw_8pysndlib_3clm_565is_biquad(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static int __pyx_f_8pysndlib_3clm_is_biquad(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, CYTHON_UNUSED int __pyx_skip_dispatch) {
int __pyx_r;
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_3);
__Pyx_AddTraceback("pysndlib.clm.is_biquad", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = -1;
__pyx_L0:;
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_565is_biquad(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_8pysndlib_3clm_565is_biquad = {"is_biquad", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_565is_biquad, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_8pysndlib_3clm_565is_biquad(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("is_biquad (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gen,0};
PyObject* values[1] = {0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_gen)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 5295, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "is_biquad") < 0)) __PYX_ERR(0, 5295, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 1)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
}
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)values[0]);
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("is_biquad", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 5295, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.is_biquad", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gen), __pyx_ptype_8pysndlib_3clm_mus_any, 0, "gen", 0))) __PYX_ERR(0, 5295, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_564is_biquad(__pyx_self, __pyx_v_gen);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_564is_biquad(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8pysndlib_3clm_is_biquad(__pyx_v_gen, 0); if (unlikely(__pyx_t_1 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 5295, __pyx_L1_error)
__pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 5295, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("pysndlib.clm.is_biquad", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_43 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 5295, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
if (PyDict_SetItem(__pyx_t_43, __pyx_n_s_gen, __pyx_n_s_mus_any) < 0) __PYX_ERR(0, 5295, __pyx_L1_error)
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_565is_biquad, 0, __pyx_n_s_is_biquad, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__602)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 5295, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
__Pyx_CyFunction_SetAnnotationsDict(__pyx_t_40, __pyx_t_43);
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
if (PyDict_SetItem(__pyx_d, __pyx_n_s_is_biquad, __pyx_t_40) < 0) __PYX_ERR(0, 5295, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
/* … */
__pyx_codeobj__602 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__56, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_is_biquad, 5295, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__602)) __PYX_ERR(0, 5295, __pyx_L1_error)
+5296: return is_filter(gen) and (gen.mus_order == 3)
__pyx_t_2 = __pyx_f_8pysndlib_3clm_is_filter(__pyx_v_gen, 0); if (unlikely(__pyx_t_2 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 5296, __pyx_L1_error) if (__pyx_t_2) { } else { __pyx_t_1 = __pyx_t_2; goto __pyx_L3_bool_binop_done; } __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_gen), __pyx_n_s_mus_order); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 5296, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_2 = (__Pyx_PyInt_BoolEqObjC(__pyx_t_3, __pyx_int_3, 3, 0)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 5296, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_1 = __pyx_t_2; __pyx_L3_bool_binop_done:; __pyx_r = __pyx_t_1; goto __pyx_L0;
5297:
5298:
+5299: cpdef mus_any make_biquad_notch(fc: cython.double, radius: cython.double):
static PyObject *__pyx_pw_8pysndlib_3clm_567make_biquad_notch(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_f_8pysndlib_3clm_make_biquad_notch(double __pyx_v_fc, double __pyx_v_radius, CYTHON_UNUSED int __pyx_skip_dispatch) {
double __pyx_v_sr;
double __pyx_v_a0;
double __pyx_v_a1;
double __pyx_v_a2;
double __pyx_v_b1;
double __pyx_v_b2;
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_r = NULL;
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_XDECREF(__pyx_t_5);
__Pyx_XDECREF(__pyx_t_6);
__Pyx_XDECREF(__pyx_t_7);
__Pyx_AddTraceback("pysndlib.clm.make_biquad_notch", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XGIVEREF((PyObject *)__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_567make_biquad_notch(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_8pysndlib_3clm_567make_biquad_notch = {"make_biquad_notch", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_567make_biquad_notch, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_8pysndlib_3clm_567make_biquad_notch(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
double __pyx_v_fc;
double __pyx_v_radius;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("make_biquad_notch (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_fc,&__pyx_n_s_radius,0};
PyObject* values[2] = {0,0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_fc)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 5299, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_radius)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 5299, __pyx_L3_error)
else {
__Pyx_RaiseArgtupleInvalid("make_biquad_notch", 1, 2, 2, 1); __PYX_ERR(0, 5299, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "make_biquad_notch") < 0)) __PYX_ERR(0, 5299, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 2)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
}
__pyx_v_fc = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_fc == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 5299, __pyx_L3_error)
__pyx_v_radius = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_radius == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 5299, __pyx_L3_error)
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("make_biquad_notch", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 5299, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.make_biquad_notch", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_8pysndlib_3clm_566make_biquad_notch(__pyx_self, __pyx_v_fc, __pyx_v_radius);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_566make_biquad_notch(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_fc, double __pyx_v_radius) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = ((PyObject *)__pyx_f_8pysndlib_3clm_make_biquad_notch(__pyx_v_fc, __pyx_v_radius, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5299, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("pysndlib.clm.make_biquad_notch", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_tuple__603 = PyTuple_Pack(2, __pyx_n_s_fc, __pyx_n_s_radius); if (unlikely(!__pyx_tuple__603)) __PYX_ERR(0, 5299, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__603);
__Pyx_GIVEREF(__pyx_tuple__603);
/* … */
__pyx_t_40 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 5299, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
if (PyDict_SetItem(__pyx_t_40, __pyx_n_s_fc, __pyx_kp_s_cython_double) < 0) __PYX_ERR(0, 5299, __pyx_L1_error)
if (PyDict_SetItem(__pyx_t_40, __pyx_n_s_radius, __pyx_kp_s_cython_double) < 0) __PYX_ERR(0, 5299, __pyx_L1_error)
__pyx_t_43 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_567make_biquad_notch, 0, __pyx_n_s_make_biquad_notch, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__604)); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 5299, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
__Pyx_CyFunction_SetAnnotationsDict(__pyx_t_43, __pyx_t_40);
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
if (PyDict_SetItem(__pyx_d, __pyx_n_s_make_biquad_notch, __pyx_t_43) < 0) __PYX_ERR(0, 5299, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
__pyx_codeobj__604 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__603, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_make_biquad_notch, 5299, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__604)) __PYX_ERR(0, 5299, __pyx_L1_error)
+5300: cdef cython.double sr = get_srate()
__pyx_t_1 = __pyx_f_8pysndlib_3clm_get_srate(0); if (unlikely(__pyx_t_1 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 5300, __pyx_L1_error) __pyx_v_sr = __pyx_t_1;
+5301: cdef cython.double a0 = 1.0
__pyx_v_a0 = 1.0;
+5302: cdef cython.double a1 = 2.0 * radius * math.cos((np.pi*2) * fc / sr)
__pyx_t_2 = PyFloat_FromDouble((2.0 * __pyx_v_radius)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 5302, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_math); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 5302, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_cos); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 5302, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 5302, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_pi); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 5302, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = __Pyx_PyInt_MultiplyObjC(__pyx_t_6, __pyx_int_2, 2, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 5302, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_6 = PyFloat_FromDouble(__pyx_v_fc); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 5302, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_7 = PyNumber_Multiply(__pyx_t_4, __pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 5302, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_6 = PyFloat_FromDouble(__pyx_v_sr); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 5302, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_4 = __Pyx_PyNumber_Divide(__pyx_t_7, __pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 5302, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_6 = NULL; __pyx_t_8 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_5))) { __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5); if (likely(__pyx_t_6)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); __Pyx_INCREF(__pyx_t_6); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_5, function); __pyx_t_8 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_t_4}; __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_8, 1+__pyx_t_8); __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 5302, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } __pyx_t_5 = PyNumber_Multiply(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 5302, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_1 = __pyx_PyFloat_AsDouble(__pyx_t_5); if (unlikely((__pyx_t_1 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 5302, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_v_a1 = __pyx_t_1;
+5303: cdef cython.double a2 = radius * radius
__pyx_v_a2 = (__pyx_v_radius * __pyx_v_radius);
+5304: cdef cython.double b1 = 0.0
__pyx_v_b1 = 0.0;
+5305: cdef cython.double b2 = 0.0
__pyx_v_b2 = 0.0;
+5306: return make_biquad(a0, a1, a2, b1, b2)
__Pyx_XDECREF((PyObject *)__pyx_r); __pyx_t_5 = ((PyObject *)__pyx_f_8pysndlib_3clm_make_biquad(__pyx_v_a0, __pyx_v_a1, __pyx_v_a2, __pyx_v_b1, __pyx_v_b2, 0)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 5306, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_r = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_t_5); __pyx_t_5 = 0; goto __pyx_L0;
5307:
+5308: cpdef mus_any make_biquad_low_pass(fc: cython.double, q: cython.double):
static PyObject *__pyx_pw_8pysndlib_3clm_569make_biquad_low_pass(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_f_8pysndlib_3clm_make_biquad_low_pass(double __pyx_v_fc, double __pyx_v_q, CYTHON_UNUSED int __pyx_skip_dispatch) {
double __pyx_v_sr;
double __pyx_v_k;
double __pyx_v_ksqr;
double __pyx_v_denom;
double __pyx_v_b1;
double __pyx_v_b2;
double __pyx_v_a0;
double __pyx_v_a1;
double __pyx_v_a2;
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_r = NULL;
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_XDECREF(__pyx_t_5);
__Pyx_XDECREF(__pyx_t_6);
__Pyx_AddTraceback("pysndlib.clm.make_biquad_low_pass", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XGIVEREF((PyObject *)__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_569make_biquad_low_pass(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_8pysndlib_3clm_569make_biquad_low_pass = {"make_biquad_low_pass", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_569make_biquad_low_pass, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_8pysndlib_3clm_569make_biquad_low_pass(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
double __pyx_v_fc;
double __pyx_v_q;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("make_biquad_low_pass (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_fc,&__pyx_n_s_q,0};
PyObject* values[2] = {0,0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_fc)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 5308, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_q)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 5308, __pyx_L3_error)
else {
__Pyx_RaiseArgtupleInvalid("make_biquad_low_pass", 1, 2, 2, 1); __PYX_ERR(0, 5308, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "make_biquad_low_pass") < 0)) __PYX_ERR(0, 5308, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 2)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
}
__pyx_v_fc = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_fc == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 5308, __pyx_L3_error)
__pyx_v_q = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_q == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 5308, __pyx_L3_error)
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("make_biquad_low_pass", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 5308, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.make_biquad_low_pass", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_8pysndlib_3clm_568make_biquad_low_pass(__pyx_self, __pyx_v_fc, __pyx_v_q);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_568make_biquad_low_pass(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_fc, double __pyx_v_q) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = ((PyObject *)__pyx_f_8pysndlib_3clm_make_biquad_low_pass(__pyx_v_fc, __pyx_v_q, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5308, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("pysndlib.clm.make_biquad_low_pass", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_tuple__605 = PyTuple_Pack(2, __pyx_n_s_fc, __pyx_n_s_q); if (unlikely(!__pyx_tuple__605)) __PYX_ERR(0, 5308, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__605);
__Pyx_GIVEREF(__pyx_tuple__605);
/* … */
__pyx_t_43 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 5308, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
if (PyDict_SetItem(__pyx_t_43, __pyx_n_s_fc, __pyx_kp_s_cython_double) < 0) __PYX_ERR(0, 5308, __pyx_L1_error)
if (PyDict_SetItem(__pyx_t_43, __pyx_n_s_q, __pyx_kp_s_cython_double) < 0) __PYX_ERR(0, 5308, __pyx_L1_error)
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_569make_biquad_low_pass, 0, __pyx_n_s_make_biquad_low_pass, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__606)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 5308, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
__Pyx_CyFunction_SetAnnotationsDict(__pyx_t_40, __pyx_t_43);
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
if (PyDict_SetItem(__pyx_d, __pyx_n_s_make_biquad_low_pass, __pyx_t_40) < 0) __PYX_ERR(0, 5308, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
__pyx_codeobj__606 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__605, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_make_biquad_low_pass, 5308, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__606)) __PYX_ERR(0, 5308, __pyx_L1_error)
+5309: cdef cython.double sr = get_srate()
__pyx_t_1 = __pyx_f_8pysndlib_3clm_get_srate(0); if (unlikely(__pyx_t_1 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 5309, __pyx_L1_error) __pyx_v_sr = __pyx_t_1;
+5310: cdef cython.double k = math.tan(np.pi * fc / sr)
__Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_math); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 5310, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_tan); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 5310, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 5310, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_pi); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 5310, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyFloat_FromDouble(__pyx_v_fc); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 5310, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_6 = PyNumber_Multiply(__pyx_t_5, __pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 5310, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyFloat_FromDouble(__pyx_v_sr); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 5310, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = __Pyx_PyNumber_Divide(__pyx_t_6, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 5310, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = NULL; __pyx_t_7 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_4))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_4, function); __pyx_t_7 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_5}; __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 5310, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } __pyx_t_1 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_1 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 5310, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v_k = __pyx_t_1;
+5311: cdef cython.double ksqr = k * k
__pyx_v_ksqr = (__pyx_v_k * __pyx_v_k);
+5312: cdef cython.double denom = 1.0 / (ksqr * q + k + q)
__pyx_t_1 = (((__pyx_v_ksqr * __pyx_v_q) + __pyx_v_k) + __pyx_v_q);
if (unlikely(__pyx_t_1 == 0)) {
PyErr_SetString(PyExc_ZeroDivisionError, "float division");
__PYX_ERR(0, 5312, __pyx_L1_error)
}
__pyx_v_denom = (1.0 / __pyx_t_1);
+5313: cdef cython.double b1 = 2 * q * (ksqr - 1) * denom
__pyx_v_b1 = (((2.0 * __pyx_v_q) * (__pyx_v_ksqr - 1.0)) * __pyx_v_denom);
+5314: cdef cython.double b2 = (ksqr * q - k + q) * denom
__pyx_v_b2 = ((((__pyx_v_ksqr * __pyx_v_q) - __pyx_v_k) + __pyx_v_q) * __pyx_v_denom);
5315:
+5316: cdef cython.double a0 = ksqr * q * denom
__pyx_v_a0 = ((__pyx_v_ksqr * __pyx_v_q) * __pyx_v_denom);
+5317: cdef cython.double a1 = 2 * a0
__pyx_v_a1 = (2.0 * __pyx_v_a0);
+5318: cdef cython.double a2 = a0
__pyx_v_a2 = __pyx_v_a0;
5319:
+5320: return make_biquad(a0, a1, a2, b1, b2)
__Pyx_XDECREF((PyObject *)__pyx_r); __pyx_t_2 = ((PyObject *)__pyx_f_8pysndlib_3clm_make_biquad(__pyx_v_a0, __pyx_v_a1, __pyx_v_a2, __pyx_v_b1, __pyx_v_b2, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 5320, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_r = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_t_2); __pyx_t_2 = 0; goto __pyx_L0;
5321:
+5322: cpdef mus_any make_biquad_high_pass(fc: cython.double, q: cython.double):
static PyObject *__pyx_pw_8pysndlib_3clm_571make_biquad_high_pass(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_f_8pysndlib_3clm_make_biquad_high_pass(double __pyx_v_fc, double __pyx_v_q, CYTHON_UNUSED int __pyx_skip_dispatch) {
double __pyx_v_sr;
double __pyx_v_k;
double __pyx_v_ksqr;
double __pyx_v_denom;
double __pyx_v_b1;
double __pyx_v_b2;
double __pyx_v_a0;
double __pyx_v_a1;
double __pyx_v_a2;
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_r = NULL;
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_XDECREF(__pyx_t_5);
__Pyx_XDECREF(__pyx_t_6);
__Pyx_AddTraceback("pysndlib.clm.make_biquad_high_pass", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XGIVEREF((PyObject *)__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_571make_biquad_high_pass(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_8pysndlib_3clm_571make_biquad_high_pass = {"make_biquad_high_pass", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_571make_biquad_high_pass, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_8pysndlib_3clm_571make_biquad_high_pass(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
double __pyx_v_fc;
double __pyx_v_q;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("make_biquad_high_pass (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_fc,&__pyx_n_s_q,0};
PyObject* values[2] = {0,0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_fc)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 5322, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_q)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 5322, __pyx_L3_error)
else {
__Pyx_RaiseArgtupleInvalid("make_biquad_high_pass", 1, 2, 2, 1); __PYX_ERR(0, 5322, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "make_biquad_high_pass") < 0)) __PYX_ERR(0, 5322, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 2)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
}
__pyx_v_fc = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_fc == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 5322, __pyx_L3_error)
__pyx_v_q = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_q == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 5322, __pyx_L3_error)
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("make_biquad_high_pass", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 5322, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.make_biquad_high_pass", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_8pysndlib_3clm_570make_biquad_high_pass(__pyx_self, __pyx_v_fc, __pyx_v_q);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_570make_biquad_high_pass(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_fc, double __pyx_v_q) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = ((PyObject *)__pyx_f_8pysndlib_3clm_make_biquad_high_pass(__pyx_v_fc, __pyx_v_q, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5322, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("pysndlib.clm.make_biquad_high_pass", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_40 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 5322, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
if (PyDict_SetItem(__pyx_t_40, __pyx_n_s_fc, __pyx_kp_s_cython_double) < 0) __PYX_ERR(0, 5322, __pyx_L1_error)
if (PyDict_SetItem(__pyx_t_40, __pyx_n_s_q, __pyx_kp_s_cython_double) < 0) __PYX_ERR(0, 5322, __pyx_L1_error)
__pyx_t_43 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_571make_biquad_high_pass, 0, __pyx_n_s_make_biquad_high_pass, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__607)); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 5322, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
__Pyx_CyFunction_SetAnnotationsDict(__pyx_t_43, __pyx_t_40);
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
if (PyDict_SetItem(__pyx_d, __pyx_n_s_make_biquad_high_pass, __pyx_t_43) < 0) __PYX_ERR(0, 5322, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
/* … */
__pyx_codeobj__607 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__605, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_make_biquad_high_pass, 5322, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__607)) __PYX_ERR(0, 5322, __pyx_L1_error)
+5323: cdef cython.double sr = get_srate()
__pyx_t_1 = __pyx_f_8pysndlib_3clm_get_srate(0); if (unlikely(__pyx_t_1 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 5323, __pyx_L1_error) __pyx_v_sr = __pyx_t_1;
+5324: cdef cython.double k = math.tan(np.pi * fc / sr)
__Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_math); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 5324, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_tan); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 5324, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 5324, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_pi); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 5324, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyFloat_FromDouble(__pyx_v_fc); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 5324, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_6 = PyNumber_Multiply(__pyx_t_5, __pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 5324, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyFloat_FromDouble(__pyx_v_sr); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 5324, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = __Pyx_PyNumber_Divide(__pyx_t_6, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 5324, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = NULL; __pyx_t_7 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_4))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_4, function); __pyx_t_7 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_5}; __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 5324, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } __pyx_t_1 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_1 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 5324, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v_k = __pyx_t_1;
+5325: cdef cython.double ksqr = k * k
__pyx_v_ksqr = (__pyx_v_k * __pyx_v_k);
+5326: cdef cython.double denom = 1.0 / (ksqr * q + k + q)
__pyx_t_1 = (((__pyx_v_ksqr * __pyx_v_q) + __pyx_v_k) + __pyx_v_q);
if (unlikely(__pyx_t_1 == 0)) {
PyErr_SetString(PyExc_ZeroDivisionError, "float division");
__PYX_ERR(0, 5326, __pyx_L1_error)
}
__pyx_v_denom = (1.0 / __pyx_t_1);
+5327: cdef cython.double b1 = 2 * q * (ksqr - 1) * denom
__pyx_v_b1 = (((2.0 * __pyx_v_q) * (__pyx_v_ksqr - 1.0)) * __pyx_v_denom);
+5328: cdef cython.double b2 = (ksqr * q - k + q) * denom
__pyx_v_b2 = ((((__pyx_v_ksqr * __pyx_v_q) - __pyx_v_k) + __pyx_v_q) * __pyx_v_denom);
5329:
+5330: cdef cython.double a0 = q * denom
__pyx_v_a0 = (__pyx_v_q * __pyx_v_denom);
+5331: cdef cython.double a1 = -2 * a0
__pyx_v_a1 = (-2.0 * __pyx_v_a0);
+5332: cdef cython.double a2 = a0
__pyx_v_a2 = __pyx_v_a0;
5333:
+5334: return make_biquad(a0, a1, a2, b1, b2)
__Pyx_XDECREF((PyObject *)__pyx_r); __pyx_t_2 = ((PyObject *)__pyx_f_8pysndlib_3clm_make_biquad(__pyx_v_a0, __pyx_v_a1, __pyx_v_a2, __pyx_v_b1, __pyx_v_b2, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 5334, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_r = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_t_2); __pyx_t_2 = 0; goto __pyx_L0;
5335:
+5336: cpdef mus_any make_biquad_band_pass(fc: cython.double, q: cython.double):
static PyObject *__pyx_pw_8pysndlib_3clm_573make_biquad_band_pass(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_f_8pysndlib_3clm_make_biquad_band_pass(double __pyx_v_fc, double __pyx_v_q, CYTHON_UNUSED int __pyx_skip_dispatch) {
double __pyx_v_sr;
double __pyx_v_k;
double __pyx_v_ksqr;
double __pyx_v_denom;
double __pyx_v_b1;
double __pyx_v_b2;
double __pyx_v_a0;
double __pyx_v_a1;
double __pyx_v_a2;
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_r = NULL;
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_XDECREF(__pyx_t_5);
__Pyx_XDECREF(__pyx_t_6);
__Pyx_AddTraceback("pysndlib.clm.make_biquad_band_pass", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XGIVEREF((PyObject *)__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_573make_biquad_band_pass(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_8pysndlib_3clm_573make_biquad_band_pass = {"make_biquad_band_pass", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_573make_biquad_band_pass, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_8pysndlib_3clm_573make_biquad_band_pass(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
double __pyx_v_fc;
double __pyx_v_q;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("make_biquad_band_pass (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_fc,&__pyx_n_s_q,0};
PyObject* values[2] = {0,0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_fc)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 5336, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_q)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 5336, __pyx_L3_error)
else {
__Pyx_RaiseArgtupleInvalid("make_biquad_band_pass", 1, 2, 2, 1); __PYX_ERR(0, 5336, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "make_biquad_band_pass") < 0)) __PYX_ERR(0, 5336, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 2)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
}
__pyx_v_fc = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_fc == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 5336, __pyx_L3_error)
__pyx_v_q = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_q == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 5336, __pyx_L3_error)
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("make_biquad_band_pass", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 5336, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.make_biquad_band_pass", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_8pysndlib_3clm_572make_biquad_band_pass(__pyx_self, __pyx_v_fc, __pyx_v_q);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_572make_biquad_band_pass(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_fc, double __pyx_v_q) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = ((PyObject *)__pyx_f_8pysndlib_3clm_make_biquad_band_pass(__pyx_v_fc, __pyx_v_q, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5336, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("pysndlib.clm.make_biquad_band_pass", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_43 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 5336, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
if (PyDict_SetItem(__pyx_t_43, __pyx_n_s_fc, __pyx_kp_s_cython_double) < 0) __PYX_ERR(0, 5336, __pyx_L1_error)
if (PyDict_SetItem(__pyx_t_43, __pyx_n_s_q, __pyx_kp_s_cython_double) < 0) __PYX_ERR(0, 5336, __pyx_L1_error)
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_573make_biquad_band_pass, 0, __pyx_n_s_make_biquad_band_pass, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__608)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 5336, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
__Pyx_CyFunction_SetAnnotationsDict(__pyx_t_40, __pyx_t_43);
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
if (PyDict_SetItem(__pyx_d, __pyx_n_s_make_biquad_band_pass, __pyx_t_40) < 0) __PYX_ERR(0, 5336, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
/* … */
__pyx_codeobj__608 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__605, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_make_biquad_band_pass, 5336, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__608)) __PYX_ERR(0, 5336, __pyx_L1_error)
+5337: cdef cython.double sr = get_srate()
__pyx_t_1 = __pyx_f_8pysndlib_3clm_get_srate(0); if (unlikely(__pyx_t_1 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 5337, __pyx_L1_error) __pyx_v_sr = __pyx_t_1;
+5338: cdef cython.double k = math.tan(np.pi * fc / sr)
__Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_math); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 5338, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_tan); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 5338, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 5338, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_pi); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 5338, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyFloat_FromDouble(__pyx_v_fc); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 5338, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_6 = PyNumber_Multiply(__pyx_t_5, __pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 5338, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyFloat_FromDouble(__pyx_v_sr); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 5338, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = __Pyx_PyNumber_Divide(__pyx_t_6, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 5338, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = NULL; __pyx_t_7 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_4))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_4, function); __pyx_t_7 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_5}; __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 5338, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } __pyx_t_1 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_1 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 5338, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v_k = __pyx_t_1;
+5339: cdef cython.double ksqr = k * k
__pyx_v_ksqr = (__pyx_v_k * __pyx_v_k);
+5340: cdef cython.double denom = 1.0 / (ksqr * q + k + q)
__pyx_t_1 = (((__pyx_v_ksqr * __pyx_v_q) + __pyx_v_k) + __pyx_v_q);
if (unlikely(__pyx_t_1 == 0)) {
PyErr_SetString(PyExc_ZeroDivisionError, "float division");
__PYX_ERR(0, 5340, __pyx_L1_error)
}
__pyx_v_denom = (1.0 / __pyx_t_1);
+5341: cdef cython.double b1 = 2 * q * (ksqr - 1) * denom
__pyx_v_b1 = (((2.0 * __pyx_v_q) * (__pyx_v_ksqr - 1.0)) * __pyx_v_denom);
+5342: cdef cython.double b2 = (ksqr * q - k + q) * denom
__pyx_v_b2 = ((((__pyx_v_ksqr * __pyx_v_q) - __pyx_v_k) + __pyx_v_q) * __pyx_v_denom);
5343:
+5344: cdef cython.double a0 = k * denom
__pyx_v_a0 = (__pyx_v_k * __pyx_v_denom);
+5345: cdef cython.double a1 = 0.0
__pyx_v_a1 = 0.0;
+5346: cdef cython.double a2 = -a0
__pyx_v_a2 = (-__pyx_v_a0);
5347:
+5348: return make_biquad(a0, a1, a2, b1, b2)
__Pyx_XDECREF((PyObject *)__pyx_r); __pyx_t_2 = ((PyObject *)__pyx_f_8pysndlib_3clm_make_biquad(__pyx_v_a0, __pyx_v_a1, __pyx_v_a2, __pyx_v_b1, __pyx_v_b2, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 5348, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_r = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_t_2); __pyx_t_2 = 0; goto __pyx_L0;
5349:
+5350: cpdef mus_any make_biquad_band_reject(fc: cython.double, q: cython.double):
static PyObject *__pyx_pw_8pysndlib_3clm_575make_biquad_band_reject(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_f_8pysndlib_3clm_make_biquad_band_reject(double __pyx_v_fc, double __pyx_v_q, CYTHON_UNUSED int __pyx_skip_dispatch) {
double __pyx_v_sr;
double __pyx_v_k;
double __pyx_v_ksqr;
double __pyx_v_denom;
double __pyx_v_b1;
double __pyx_v_b2;
double __pyx_v_a0;
double __pyx_v_a1;
double __pyx_v_a2;
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_r = NULL;
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_XDECREF(__pyx_t_5);
__Pyx_XDECREF(__pyx_t_6);
__Pyx_AddTraceback("pysndlib.clm.make_biquad_band_reject", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XGIVEREF((PyObject *)__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_575make_biquad_band_reject(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_8pysndlib_3clm_575make_biquad_band_reject = {"make_biquad_band_reject", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_575make_biquad_band_reject, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_8pysndlib_3clm_575make_biquad_band_reject(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
double __pyx_v_fc;
double __pyx_v_q;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("make_biquad_band_reject (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_fc,&__pyx_n_s_q,0};
PyObject* values[2] = {0,0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_fc)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 5350, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_q)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 5350, __pyx_L3_error)
else {
__Pyx_RaiseArgtupleInvalid("make_biquad_band_reject", 1, 2, 2, 1); __PYX_ERR(0, 5350, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "make_biquad_band_reject") < 0)) __PYX_ERR(0, 5350, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 2)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
}
__pyx_v_fc = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_fc == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 5350, __pyx_L3_error)
__pyx_v_q = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_q == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 5350, __pyx_L3_error)
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("make_biquad_band_reject", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 5350, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.make_biquad_band_reject", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_8pysndlib_3clm_574make_biquad_band_reject(__pyx_self, __pyx_v_fc, __pyx_v_q);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_574make_biquad_band_reject(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_fc, double __pyx_v_q) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = ((PyObject *)__pyx_f_8pysndlib_3clm_make_biquad_band_reject(__pyx_v_fc, __pyx_v_q, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5350, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("pysndlib.clm.make_biquad_band_reject", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_40 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 5350, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
if (PyDict_SetItem(__pyx_t_40, __pyx_n_s_fc, __pyx_kp_s_cython_double) < 0) __PYX_ERR(0, 5350, __pyx_L1_error)
if (PyDict_SetItem(__pyx_t_40, __pyx_n_s_q, __pyx_kp_s_cython_double) < 0) __PYX_ERR(0, 5350, __pyx_L1_error)
__pyx_t_43 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_575make_biquad_band_reject, 0, __pyx_n_s_make_biquad_band_reject, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__609)); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 5350, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
__Pyx_CyFunction_SetAnnotationsDict(__pyx_t_43, __pyx_t_40);
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
if (PyDict_SetItem(__pyx_d, __pyx_n_s_make_biquad_band_reject, __pyx_t_43) < 0) __PYX_ERR(0, 5350, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
/* … */
__pyx_codeobj__609 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__605, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_make_biquad_band_reject, 5350, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__609)) __PYX_ERR(0, 5350, __pyx_L1_error)
+5351: cdef cython.double sr = get_srate()
__pyx_t_1 = __pyx_f_8pysndlib_3clm_get_srate(0); if (unlikely(__pyx_t_1 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 5351, __pyx_L1_error) __pyx_v_sr = __pyx_t_1;
+5352: cdef cython.double k = math.tan(np.pi * fc / sr)
__Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_math); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 5352, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_tan); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 5352, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 5352, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_pi); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 5352, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyFloat_FromDouble(__pyx_v_fc); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 5352, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_6 = PyNumber_Multiply(__pyx_t_5, __pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 5352, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyFloat_FromDouble(__pyx_v_sr); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 5352, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = __Pyx_PyNumber_Divide(__pyx_t_6, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 5352, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = NULL; __pyx_t_7 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_4))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_4, function); __pyx_t_7 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_5}; __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 5352, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } __pyx_t_1 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_1 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 5352, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v_k = __pyx_t_1;
+5353: cdef cython.double ksqr = k * k
__pyx_v_ksqr = (__pyx_v_k * __pyx_v_k);
+5354: cdef cython.double denom = 1.0 / (ksqr * q + k + q)
__pyx_t_1 = (((__pyx_v_ksqr * __pyx_v_q) + __pyx_v_k) + __pyx_v_q);
if (unlikely(__pyx_t_1 == 0)) {
PyErr_SetString(PyExc_ZeroDivisionError, "float division");
__PYX_ERR(0, 5354, __pyx_L1_error)
}
__pyx_v_denom = (1.0 / __pyx_t_1);
+5355: cdef cython.double b1 = 2 * q * (ksqr - 1) * denom
__pyx_v_b1 = (((2.0 * __pyx_v_q) * (__pyx_v_ksqr - 1.0)) * __pyx_v_denom);
+5356: cdef cython.double b2 = (ksqr * q - k + q) * denom
__pyx_v_b2 = ((((__pyx_v_ksqr * __pyx_v_q) - __pyx_v_k) + __pyx_v_q) * __pyx_v_denom);
5357:
+5358: cdef cython.double a0 = q * (ksqr + 1.) * denom
__pyx_v_a0 = ((__pyx_v_q * (__pyx_v_ksqr + 1.)) * __pyx_v_denom);
+5359: cdef cython.double a1 = 2.0 * q * (ksqr - 1.) * denom
__pyx_v_a1 = (((2.0 * __pyx_v_q) * (__pyx_v_ksqr - 1.)) * __pyx_v_denom);
+5360: cdef cython.double a2 = a0
__pyx_v_a2 = __pyx_v_a0;
5361:
+5362: return make_biquad(a0, a1, a2, b1, b2)
__Pyx_XDECREF((PyObject *)__pyx_r); __pyx_t_2 = ((PyObject *)__pyx_f_8pysndlib_3clm_make_biquad(__pyx_v_a0, __pyx_v_a1, __pyx_v_a2, __pyx_v_b1, __pyx_v_b2, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 5362, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_r = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_t_2); __pyx_t_2 = 0; goto __pyx_L0;
5363:
+5364: cpdef mus_any make_biquad_all_pass(fc: cython.double, q: cython.double):
static PyObject *__pyx_pw_8pysndlib_3clm_577make_biquad_all_pass(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_f_8pysndlib_3clm_make_biquad_all_pass(double __pyx_v_fc, double __pyx_v_q, CYTHON_UNUSED int __pyx_skip_dispatch) {
double __pyx_v_sr;
double __pyx_v_k;
double __pyx_v_ksqr;
double __pyx_v_denom;
double __pyx_v_b1;
double __pyx_v_b2;
double __pyx_v_a0;
double __pyx_v_a1;
double __pyx_v_a2;
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_r = NULL;
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_XDECREF(__pyx_t_5);
__Pyx_XDECREF(__pyx_t_6);
__Pyx_AddTraceback("pysndlib.clm.make_biquad_all_pass", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XGIVEREF((PyObject *)__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_577make_biquad_all_pass(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_8pysndlib_3clm_577make_biquad_all_pass = {"make_biquad_all_pass", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_577make_biquad_all_pass, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_8pysndlib_3clm_577make_biquad_all_pass(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
double __pyx_v_fc;
double __pyx_v_q;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("make_biquad_all_pass (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_fc,&__pyx_n_s_q,0};
PyObject* values[2] = {0,0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_fc)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 5364, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_q)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 5364, __pyx_L3_error)
else {
__Pyx_RaiseArgtupleInvalid("make_biquad_all_pass", 1, 2, 2, 1); __PYX_ERR(0, 5364, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "make_biquad_all_pass") < 0)) __PYX_ERR(0, 5364, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 2)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
}
__pyx_v_fc = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_fc == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 5364, __pyx_L3_error)
__pyx_v_q = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_q == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 5364, __pyx_L3_error)
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("make_biquad_all_pass", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 5364, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.make_biquad_all_pass", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_8pysndlib_3clm_576make_biquad_all_pass(__pyx_self, __pyx_v_fc, __pyx_v_q);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_576make_biquad_all_pass(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_fc, double __pyx_v_q) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = ((PyObject *)__pyx_f_8pysndlib_3clm_make_biquad_all_pass(__pyx_v_fc, __pyx_v_q, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5364, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("pysndlib.clm.make_biquad_all_pass", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_43 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 5364, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
if (PyDict_SetItem(__pyx_t_43, __pyx_n_s_fc, __pyx_kp_s_cython_double) < 0) __PYX_ERR(0, 5364, __pyx_L1_error)
if (PyDict_SetItem(__pyx_t_43, __pyx_n_s_q, __pyx_kp_s_cython_double) < 0) __PYX_ERR(0, 5364, __pyx_L1_error)
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_577make_biquad_all_pass, 0, __pyx_n_s_make_biquad_all_pass, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__610)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 5364, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
__Pyx_CyFunction_SetAnnotationsDict(__pyx_t_40, __pyx_t_43);
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
if (PyDict_SetItem(__pyx_d, __pyx_n_s_make_biquad_all_pass, __pyx_t_40) < 0) __PYX_ERR(0, 5364, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
/* … */
__pyx_codeobj__610 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__605, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_make_biquad_all_pass, 5364, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__610)) __PYX_ERR(0, 5364, __pyx_L1_error)
+5365: cdef cython.double sr = get_srate()
__pyx_t_1 = __pyx_f_8pysndlib_3clm_get_srate(0); if (unlikely(__pyx_t_1 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 5365, __pyx_L1_error) __pyx_v_sr = __pyx_t_1;
+5366: cdef cython.double k = math.tan(np.pi * fc / sr)
__Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_math); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 5366, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_tan); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 5366, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 5366, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_pi); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 5366, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyFloat_FromDouble(__pyx_v_fc); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 5366, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_6 = PyNumber_Multiply(__pyx_t_5, __pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 5366, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyFloat_FromDouble(__pyx_v_sr); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 5366, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = __Pyx_PyNumber_Divide(__pyx_t_6, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 5366, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = NULL; __pyx_t_7 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_4))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_4, function); __pyx_t_7 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_5}; __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 5366, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } __pyx_t_1 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_1 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 5366, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v_k = __pyx_t_1;
+5367: cdef cython.double ksqr = k * k
__pyx_v_ksqr = (__pyx_v_k * __pyx_v_k);
+5368: cdef cython.double denom = 1.0 / (ksqr * q + k + q)
__pyx_t_1 = (((__pyx_v_ksqr * __pyx_v_q) + __pyx_v_k) + __pyx_v_q);
if (unlikely(__pyx_t_1 == 0)) {
PyErr_SetString(PyExc_ZeroDivisionError, "float division");
__PYX_ERR(0, 5368, __pyx_L1_error)
}
__pyx_v_denom = (1.0 / __pyx_t_1);
+5369: cdef cython.double b1 = 2 * q * (ksqr - 1) * denom
__pyx_v_b1 = (((2.0 * __pyx_v_q) * (__pyx_v_ksqr - 1.0)) * __pyx_v_denom);
+5370: cdef cython.double b2 = (ksqr * q - k + q) * denom
__pyx_v_b2 = ((((__pyx_v_ksqr * __pyx_v_q) - __pyx_v_k) + __pyx_v_q) * __pyx_v_denom);
5371:
+5372: cdef cython.double a0 = b2
__pyx_v_a0 = __pyx_v_b2;
+5373: cdef cython.double a1 = b1
__pyx_v_a1 = __pyx_v_b1;
+5374: cdef cython.double a2 = 1.
__pyx_v_a2 = 1.;
5375:
+5376: return make_biquad(a0, a1, a2, b1, b2)
__Pyx_XDECREF((PyObject *)__pyx_r); __pyx_t_2 = ((PyObject *)__pyx_f_8pysndlib_3clm_make_biquad(__pyx_v_a0, __pyx_v_a1, __pyx_v_a2, __pyx_v_b1, __pyx_v_b2, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 5376, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_r = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_t_2); __pyx_t_2 = 0; goto __pyx_L0;
5377:
+5378: cpdef biquad_set_resonance(gen: mus_any, fc: cython.double, radius: cython.double, normalize:Optional[bint]=False):
static PyObject *__pyx_pw_8pysndlib_3clm_579biquad_set_resonance(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyObject *__pyx_f_8pysndlib_3clm_biquad_set_resonance(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, double __pyx_v_fc, double __pyx_v_radius, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_8pysndlib_3clm_biquad_set_resonance *__pyx_optional_args) {
PyObject *__pyx_v_normalize = ((PyObject *)Py_False);
double __pyx_v_sr;
PyObject *__pyx_r = NULL;
if (__pyx_optional_args) {
if (__pyx_optional_args->__pyx_n > 0) {
__pyx_v_normalize = __pyx_optional_args->normalize;
}
}
/* … */
/* function exit code */
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_XDECREF(__pyx_t_5);
__Pyx_XDECREF(__pyx_t_6);
__Pyx_XDECREF(__pyx_t_7);
__Pyx_AddTraceback("pysndlib.clm.biquad_set_resonance", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_579biquad_set_resonance(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_8pysndlib_3clm_579biquad_set_resonance = {"biquad_set_resonance", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_579biquad_set_resonance, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_8pysndlib_3clm_579biquad_set_resonance(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = 0;
double __pyx_v_fc;
double __pyx_v_radius;
PyObject *__pyx_v_normalize = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("biquad_set_resonance (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gen,&__pyx_n_s_fc,&__pyx_n_s_radius,&__pyx_n_s_normalize,0};
PyObject* values[4] = {0,0,0,0};
values[3] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_False));
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
CYTHON_FALLTHROUGH;
case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_gen)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 5378, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_fc)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 5378, __pyx_L3_error)
else {
__Pyx_RaiseArgtupleInvalid("biquad_set_resonance", 0, 3, 4, 1); __PYX_ERR(0, 5378, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 2:
if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_radius)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[2]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 5378, __pyx_L3_error)
else {
__Pyx_RaiseArgtupleInvalid("biquad_set_resonance", 0, 3, 4, 2); __PYX_ERR(0, 5378, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 3:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_normalize);
if (value) { values[3] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 5378, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "biquad_set_resonance") < 0)) __PYX_ERR(0, 5378, __pyx_L3_error)
}
} else {
switch (__pyx_nargs) {
case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
CYTHON_FALLTHROUGH;
case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
break;
default: goto __pyx_L5_argtuple_error;
}
}
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)values[0]);
__pyx_v_fc = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_fc == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 5378, __pyx_L3_error)
__pyx_v_radius = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_radius == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 5378, __pyx_L3_error)
__pyx_v_normalize = values[3];
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("biquad_set_resonance", 0, 3, 4, __pyx_nargs); __PYX_ERR(0, 5378, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.biquad_set_resonance", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gen), __pyx_ptype_8pysndlib_3clm_mus_any, 0, "gen", 0))) __PYX_ERR(0, 5378, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_578biquad_set_resonance(__pyx_self, __pyx_v_gen, __pyx_v_fc, __pyx_v_radius, __pyx_v_normalize);
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_578biquad_set_resonance(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, double __pyx_v_fc, double __pyx_v_radius, PyObject *__pyx_v_normalize) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_2.__pyx_n = 1;
__pyx_t_2.normalize = __pyx_v_normalize;
__pyx_t_1 = __pyx_f_8pysndlib_3clm_biquad_set_resonance(__pyx_v_gen, __pyx_v_fc, __pyx_v_radius, 0, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5378, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("pysndlib.clm.biquad_set_resonance", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_tuple__611 = PyTuple_Pack(4, __pyx_n_s_gen, __pyx_n_s_fc, __pyx_n_s_radius, __pyx_n_s_normalize); if (unlikely(!__pyx_tuple__611)) __PYX_ERR(0, 5378, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__611);
__Pyx_GIVEREF(__pyx_tuple__611);
__pyx_codeobj__612 = (PyObject*)__Pyx_PyCode_New(4, 0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__611, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_biquad_set_resonance, 5378, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__612)) __PYX_ERR(0, 5378, __pyx_L1_error)
/* … */
__pyx_t_40 = __Pyx_PyDict_NewPresized(4); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 5378, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
if (PyDict_SetItem(__pyx_t_40, __pyx_n_s_gen, __pyx_n_s_mus_any) < 0) __PYX_ERR(0, 5378, __pyx_L1_error)
if (PyDict_SetItem(__pyx_t_40, __pyx_n_s_fc, __pyx_kp_s_cython_double) < 0) __PYX_ERR(0, 5378, __pyx_L1_error)
if (PyDict_SetItem(__pyx_t_40, __pyx_n_s_radius, __pyx_kp_s_cython_double) < 0) __PYX_ERR(0, 5378, __pyx_L1_error)
if (PyDict_SetItem(__pyx_t_40, __pyx_n_s_normalize, __pyx_kp_s_Optional_bint) < 0) __PYX_ERR(0, 5378, __pyx_L1_error)
__pyx_t_43 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_579biquad_set_resonance, 0, __pyx_n_s_biquad_set_resonance, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__612)); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 5378, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
__Pyx_CyFunction_SetDefaultsTuple(__pyx_t_43, __pyx_tuple__613);
__Pyx_CyFunction_SetAnnotationsDict(__pyx_t_43, __pyx_t_40);
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
if (PyDict_SetItem(__pyx_d, __pyx_n_s_biquad_set_resonance, __pyx_t_43) < 0) __PYX_ERR(0, 5378, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
__pyx_tuple__613 = PyTuple_Pack(1, Py_False); if (unlikely(!__pyx_tuple__613)) __PYX_ERR(0, 5378, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__613);
__Pyx_GIVEREF(__pyx_tuple__613);
/* … */
struct __pyx_opt_args_8pysndlib_3clm_biquad_set_resonance {
int __pyx_n;
PyObject *normalize;
};
+5379: cdef cython.double sr = get_srate()
__pyx_t_1 = __pyx_f_8pysndlib_3clm_get_srate(0); if (unlikely(__pyx_t_1 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 5379, __pyx_L1_error) __pyx_v_sr = __pyx_t_1;
+5380: gen.mus_ycoeffs[2] = radius * radius
__pyx_t_2 = PyFloat_FromDouble((__pyx_v_radius * __pyx_v_radius)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 5380, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_gen), __pyx_n_s_mus_ycoeffs); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 5380, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); if (unlikely((__Pyx_SetItemInt(__pyx_t_3, 2, __pyx_t_2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1) < 0))) __PYX_ERR(0, 5380, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+5381: gen.mus_ycoeffs[1] = -2.0 * radius * math.cos((np.pi*2) * fc / sr)
__pyx_t_2 = PyFloat_FromDouble((-2.0 * __pyx_v_radius)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 5381, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_math); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 5381, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_cos); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 5381, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 5381, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_pi); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 5381, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = __Pyx_PyInt_MultiplyObjC(__pyx_t_6, __pyx_int_2, 2, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 5381, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_6 = PyFloat_FromDouble(__pyx_v_fc); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 5381, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_7 = PyNumber_Multiply(__pyx_t_4, __pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 5381, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_6 = PyFloat_FromDouble(__pyx_v_sr); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 5381, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_4 = __Pyx_PyNumber_Divide(__pyx_t_7, __pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 5381, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_6 = NULL; __pyx_t_8 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_5))) { __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5); if (likely(__pyx_t_6)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); __Pyx_INCREF(__pyx_t_6); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_5, function); __pyx_t_8 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_t_4}; __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_8, 1+__pyx_t_8); __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 5381, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } __pyx_t_5 = PyNumber_Multiply(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 5381, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_gen), __pyx_n_s_mus_ycoeffs); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 5381, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); if (unlikely((__Pyx_SetItemInt(__pyx_t_3, 1, __pyx_t_5, long, 1, __Pyx_PyInt_From_long, 0, 0, 1) < 0))) __PYX_ERR(0, 5381, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
5382:
+5383: if normalize:
__pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_v_normalize); if (unlikely((__pyx_t_9 < 0))) __PYX_ERR(0, 5383, __pyx_L1_error) if (__pyx_t_9) { /* … */ goto __pyx_L3; }
+5384: gen.mus_xcoeffs[0] = .5 - .5 * gen.mus_ycoeffs[2]
__pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_gen), __pyx_n_s_mus_ycoeffs); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 5384, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_5, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 5384, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_5 = PyNumber_Multiply(__pyx_float__5, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 5384, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = __Pyx_PyFloat_SubtractCObj(__pyx_float__5, __pyx_t_5, .5, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 5384, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_gen), __pyx_n_s_mus_xcoeffs); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 5384, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); if (unlikely((__Pyx_SetItemInt(__pyx_t_5, 0, __pyx_t_3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1) < 0))) __PYX_ERR(0, 5384, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+5385: gen.mus_xcoeffs[1] = 0.0
__pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_gen), __pyx_n_s_mus_xcoeffs); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 5385, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); if (unlikely((__Pyx_SetItemInt(__pyx_t_3, 1, __pyx_float_0_0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1) < 0))) __PYX_ERR(0, 5385, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+5386: gen.mus_xcoeffs[2] = -gen.mus_xcoeffs[0]
__pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_gen), __pyx_n_s_mus_xcoeffs); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 5386, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = __Pyx_GetItemInt(__pyx_t_3, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 5386, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyNumber_Negative(__pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 5386, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_gen), __pyx_n_s_mus_xcoeffs); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 5386, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); if (unlikely((__Pyx_SetItemInt(__pyx_t_5, 2, __pyx_t_3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1) < 0))) __PYX_ERR(0, 5386, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5387: else:
+5388: gen.mus_xcoeffs[0] = 1.0
/*else*/ {
__pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_gen), __pyx_n_s_mus_xcoeffs); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 5388, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
if (unlikely((__Pyx_SetItemInt(__pyx_t_3, 0, __pyx_float_1_0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1) < 0))) __PYX_ERR(0, 5388, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+5389: gen.mus_xcoeffs[1] = 0.0
__pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_gen), __pyx_n_s_mus_xcoeffs); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 5389, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); if (unlikely((__Pyx_SetItemInt(__pyx_t_3, 1, __pyx_float_0_0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1) < 0))) __PYX_ERR(0, 5389, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+5390: gen.mus_xcoeffs[2] = 0.0
__pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_gen), __pyx_n_s_mus_xcoeffs); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 5390, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); if (unlikely((__Pyx_SetItemInt(__pyx_t_3, 2, __pyx_float_0_0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1) < 0))) __PYX_ERR(0, 5390, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } __pyx_L3:;
5391:
+5392: cpdef biquad_set_equal_gain_zeroes(gen: mus_any):
static PyObject *__pyx_pw_8pysndlib_3clm_581biquad_set_equal_gain_zeroes(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyObject *__pyx_f_8pysndlib_3clm_biquad_set_equal_gain_zeroes(struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen, CYTHON_UNUSED int __pyx_skip_dispatch) {
PyObject *__pyx_r = NULL;
/* … */
/* function exit code */
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("pysndlib.clm.biquad_set_equal_gain_zeroes", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_581biquad_set_equal_gain_zeroes(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_8pysndlib_3clm_581biquad_set_equal_gain_zeroes = {"biquad_set_equal_gain_zeroes", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_581biquad_set_equal_gain_zeroes, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_8pysndlib_3clm_581biquad_set_equal_gain_zeroes(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("biquad_set_equal_gain_zeroes (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gen,0};
PyObject* values[1] = {0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_gen)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 5392, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "biquad_set_equal_gain_zeroes") < 0)) __PYX_ERR(0, 5392, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 1)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
}
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)values[0]);
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("biquad_set_equal_gain_zeroes", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 5392, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.biquad_set_equal_gain_zeroes", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gen), __pyx_ptype_8pysndlib_3clm_mus_any, 0, "gen", 0))) __PYX_ERR(0, 5392, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_580biquad_set_equal_gain_zeroes(__pyx_self, __pyx_v_gen);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_580biquad_set_equal_gain_zeroes(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_gen) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8pysndlib_3clm_biquad_set_equal_gain_zeroes(__pyx_v_gen, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5392, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("pysndlib.clm.biquad_set_equal_gain_zeroes", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_43 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 5392, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
if (PyDict_SetItem(__pyx_t_43, __pyx_n_s_gen, __pyx_n_s_mus_any) < 0) __PYX_ERR(0, 5392, __pyx_L1_error)
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_581biquad_set_equal_gain_zeroes, 0, __pyx_n_s_biquad_set_equal_gain_zeroes, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__614)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 5392, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
__Pyx_CyFunction_SetAnnotationsDict(__pyx_t_40, __pyx_t_43);
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
if (PyDict_SetItem(__pyx_d, __pyx_n_s_biquad_set_equal_gain_zeroes, __pyx_t_40) < 0) __PYX_ERR(0, 5392, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
/* … */
__pyx_codeobj__614 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__56, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_biquad_set_equal_gain_zeroes, 5392, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__614)) __PYX_ERR(0, 5392, __pyx_L1_error)
+5393: gen.mus_xcoeffs[0] = 1.0
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_gen), __pyx_n_s_mus_xcoeffs); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5393, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (unlikely((__Pyx_SetItemInt(__pyx_t_1, 0, __pyx_float_1_0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1) < 0))) __PYX_ERR(0, 5393, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+5394: gen.mus_xcoeffs[1] = 0.0
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_gen), __pyx_n_s_mus_xcoeffs); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5394, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (unlikely((__Pyx_SetItemInt(__pyx_t_1, 1, __pyx_float_0_0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1) < 0))) __PYX_ERR(0, 5394, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+5395: gen.mus_xcoeffs[2] = -1.0
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_gen), __pyx_n_s_mus_xcoeffs); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5395, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (unlikely((__Pyx_SetItemInt(__pyx_t_1, 2, __pyx_float_neg_1_0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1) < 0))) __PYX_ERR(0, 5395, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5396:
5397:
5398:
+5399: def convert_frequency(gen):
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_583convert_frequency(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_8pysndlib_3clm_583convert_frequency = {"convert_frequency", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_583convert_frequency, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_8pysndlib_3clm_583convert_frequency(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
PyObject *__pyx_v_gen = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("convert_frequency (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gen,0};
PyObject* values[1] = {0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_gen)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 5399, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "convert_frequency") < 0)) __PYX_ERR(0, 5399, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 1)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
}
__pyx_v_gen = values[0];
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("convert_frequency", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 5399, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.convert_frequency", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_8pysndlib_3clm_582convert_frequency(__pyx_self, __pyx_v_gen);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_582convert_frequency(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_gen) {
PyObject *__pyx_r = NULL;
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("pysndlib.clm.convert_frequency", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_583convert_frequency, 0, __pyx_n_s_convert_frequency, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__615)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 5399, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_convert_frequency, __pyx_t_40) < 0) __PYX_ERR(0, 5399, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
/* … */
__pyx_codeobj__615 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__56, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_convert_frequency, 5399, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__615)) __PYX_ERR(0, 5399, __pyx_L1_error)
+5400: gen.frequency = hz2radians(gen.frequency)
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_gen, __pyx_n_s_frequency); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5400, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_2 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 5400, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_3 = __pyx_f_8pysndlib_3clm_hz2radians(__pyx_t_2, 0); if (unlikely(__pyx_t_3 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 5400, __pyx_L1_error) __pyx_t_1 = PyFloat_FromDouble(__pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5400, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (__Pyx_PyObject_SetAttrStr(__pyx_v_gen, __pyx_n_s_frequency, __pyx_t_1) < 0) __PYX_ERR(0, 5400, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+5401: return gen
__Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_v_gen); __pyx_r = __pyx_v_gen; goto __pyx_L0;
5402: #
5403:
+5404: cdef class array_readin_gen:
struct __pyx_obj_8pysndlib_3clm_array_readin_gen {
PyObject_HEAD
PyArrayObject *_arr;
int _chan;
PY_LONG_LONG _start;
int _direction;
PY_LONG_LONG _location;
PY_LONG_LONG _length;
float _val;
};
5405: cdef np.ndarray _arr
5406: cdef int _chan
5407: cdef cython.longlong _start
5408: cdef int _direction
5409: cdef cython.longlong _location
5410: cdef cython.longlong _length
5411: cdef float _val
5412:
+5413: def __init__(self, arr: npt.NDArray[np.float64], chan: Optional[int]=0, start: Optional[int]=0, direction: Optional[int]=1):
/* Python wrapper */
static int __pyx_pw_8pysndlib_3clm_16array_readin_gen_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_8pysndlib_3clm_16array_readin_gen_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_arr = 0;
PyObject *__pyx_v_chan = 0;
PyObject *__pyx_v_start = 0;
PyObject *__pyx_v_direction = 0;
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
int __pyx_r;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
#endif
__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_arr,&__pyx_n_s_chan,&__pyx_n_s_start,&__pyx_n_s_direction,0};
PyObject* values[4] = {0,0,0,0};
values[1] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)__pyx_int_0));
values[2] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)__pyx_int_0));
values[3] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)__pyx_int_1));
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 4: values[3] = __Pyx_Arg_VARARGS(__pyx_args, 3);
CYTHON_FALLTHROUGH;
case 3: values[2] = __Pyx_Arg_VARARGS(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = __Pyx_Arg_VARARGS(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_VARARGS(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_arr)) != 0)) {
(void)__Pyx_Arg_NewRef_VARARGS(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 5413, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_chan);
if (value) { values[1] = __Pyx_Arg_NewRef_VARARGS(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 5413, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 2:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_start);
if (value) { values[2] = __Pyx_Arg_NewRef_VARARGS(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 5413, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 3:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_direction);
if (value) { values[3] = __Pyx_Arg_NewRef_VARARGS(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 5413, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__init__") < 0)) __PYX_ERR(0, 5413, __pyx_L3_error)
}
} else {
switch (__pyx_nargs) {
case 4: values[3] = __Pyx_Arg_VARARGS(__pyx_args, 3);
CYTHON_FALLTHROUGH;
case 3: values[2] = __Pyx_Arg_VARARGS(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = __Pyx_Arg_VARARGS(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
break;
default: goto __pyx_L5_argtuple_error;
}
}
__pyx_v_arr = values[0];
__pyx_v_chan = values[1];
__pyx_v_start = values[2];
__pyx_v_direction = values[3];
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 4, __pyx_nargs); __PYX_ERR(0, 5413, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.array_readin_gen.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return -1;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_8pysndlib_3clm_16array_readin_gen___init__(((struct __pyx_obj_8pysndlib_3clm_array_readin_gen *)__pyx_v_self), __pyx_v_arr, __pyx_v_chan, __pyx_v_start, __pyx_v_direction);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static int __pyx_pf_8pysndlib_3clm_16array_readin_gen___init__(struct __pyx_obj_8pysndlib_3clm_array_readin_gen *__pyx_v_self, PyObject *__pyx_v_arr, PyObject *__pyx_v_chan, PyObject *__pyx_v_start, PyObject *__pyx_v_direction) {
int __pyx_r;
/* … */
/* function exit code */
__pyx_r = 0;
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_5);
__Pyx_XDECREF(__pyx_t_6);
__Pyx_AddTraceback("pysndlib.clm.array_readin_gen.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = -1;
__pyx_L0:;
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
+5414: check_ndim(arr, 2)
__pyx_t_2.__pyx_n = 1; __pyx_t_2.dim = __pyx_int_2; __pyx_t_1 = __pyx_f_8pysndlib_3clm_check_ndim(__pyx_v_arr, 0, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5414, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+5415: self._arr = arr
if (!(likely(((__pyx_v_arr) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_arr, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 5415, __pyx_L1_error) __pyx_t_1 = __pyx_v_arr; __Pyx_INCREF(__pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __Pyx_GOTREF((PyObject *)__pyx_v_self->_arr); __Pyx_DECREF((PyObject *)__pyx_v_self->_arr); __pyx_v_self->_arr = ((PyArrayObject *)__pyx_t_1); __pyx_t_1 = 0;
+5416: self._chan = chan
__pyx_t_3 = __Pyx_PyInt_As_int(__pyx_v_chan); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 5416, __pyx_L1_error) __pyx_v_self->_chan = __pyx_t_3;
+5417: self._start = start
__pyx_t_4 = __Pyx_PyInt_As_PY_LONG_LONG(__pyx_v_start); if (unlikely((__pyx_t_4 == (PY_LONG_LONG)-1) && PyErr_Occurred())) __PYX_ERR(0, 5417, __pyx_L1_error) __pyx_v_self->_start = __pyx_t_4;
+5418: self._direction = direction
__pyx_t_3 = __Pyx_PyInt_As_int(__pyx_v_direction); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 5418, __pyx_L1_error) __pyx_v_self->_direction = __pyx_t_3;
+5419: self._location = self._start
__pyx_t_4 = __pyx_v_self->_start; __pyx_v_self->_location = __pyx_t_4;
+5420: self._length = np.shape(arr)[1]
__Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 5420, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_shape); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 5420, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_5 = NULL; __pyx_t_3 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_6))) { __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6); if (likely(__pyx_t_5)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); __Pyx_INCREF(__pyx_t_5); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_6, function); __pyx_t_3 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_v_arr}; __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+1-__pyx_t_3, 1+__pyx_t_3); __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5420, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; } __pyx_t_6 = __Pyx_GetItemInt(__pyx_t_1, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 5420, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_4 = __Pyx_PyInt_As_PY_LONG_LONG(__pyx_t_6); if (unlikely((__pyx_t_4 == (PY_LONG_LONG)-1) && PyErr_Occurred())) __PYX_ERR(0, 5420, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_v_self->_length = __pyx_t_4;
5421:
+5422: @property
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_16array_readin_gen_11mus_channel_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8pysndlib_3clm_16array_readin_gen_11mus_channel_1__get__(PyObject *__pyx_v_self) {
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
__pyx_r = __pyx_pf_8pysndlib_3clm_16array_readin_gen_11mus_channel___get__(((struct __pyx_obj_8pysndlib_3clm_array_readin_gen *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_16array_readin_gen_11mus_channel___get__(struct __pyx_obj_8pysndlib_3clm_array_readin_gen *__pyx_v_self) {
PyObject *__pyx_r = NULL;
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("pysndlib.clm.array_readin_gen.mus_channel.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
5423: def mus_channel(self):
+5424: return self._chan
__Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->_chan); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5424, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
5425:
+5426: @property
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_16array_readin_gen_12mus_location_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8pysndlib_3clm_16array_readin_gen_12mus_location_1__get__(PyObject *__pyx_v_self) {
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
__pyx_r = __pyx_pf_8pysndlib_3clm_16array_readin_gen_12mus_location___get__(((struct __pyx_obj_8pysndlib_3clm_array_readin_gen *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_16array_readin_gen_12mus_location___get__(struct __pyx_obj_8pysndlib_3clm_array_readin_gen *__pyx_v_self) {
PyObject *__pyx_r = NULL;
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("pysndlib.clm.array_readin_gen.mus_location.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
5427: def mus_location(self):
+5428: return self._location
__Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyInt_From_PY_LONG_LONG(__pyx_v_self->_location); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5428, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
5429:
+5430: @mus_location.setter
/* Python wrapper */
static int __pyx_pw_8pysndlib_3clm_16array_readin_gen_12mus_location_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_v); /*proto*/
static int __pyx_pw_8pysndlib_3clm_16array_readin_gen_12mus_location_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_v) {
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
int __pyx_r;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_v), (&PyInt_Type), 0, "v", 1))) __PYX_ERR(0, 5431, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_16array_readin_gen_12mus_location_2__set__(((struct __pyx_obj_8pysndlib_3clm_array_readin_gen *)__pyx_v_self), ((PyObject*)__pyx_v_v));
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = -1;
__pyx_L0:;
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static int __pyx_pf_8pysndlib_3clm_16array_readin_gen_12mus_location_2__set__(struct __pyx_obj_8pysndlib_3clm_array_readin_gen *__pyx_v_self, PyObject *__pyx_v_v) {
int __pyx_r;
/* … */
/* function exit code */
__pyx_r = 0;
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_AddTraceback("pysndlib.clm.array_readin_gen.mus_location.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = -1;
__pyx_L0:;
return __pyx_r;
}
5431: def mus_location(self, v: int):
+5432: self._location = v
__pyx_t_1 = __Pyx_PyInt_As_PY_LONG_LONG(__pyx_v_v); if (unlikely((__pyx_t_1 == (PY_LONG_LONG)-1) && PyErr_Occurred())) __PYX_ERR(0, 5432, __pyx_L1_error) __pyx_v_self->_location = __pyx_t_1;
5433:
+5434: @property
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_16array_readin_gen_13mus_increment_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8pysndlib_3clm_16array_readin_gen_13mus_increment_1__get__(PyObject *__pyx_v_self) {
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
__pyx_r = __pyx_pf_8pysndlib_3clm_16array_readin_gen_13mus_increment___get__(((struct __pyx_obj_8pysndlib_3clm_array_readin_gen *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_16array_readin_gen_13mus_increment___get__(struct __pyx_obj_8pysndlib_3clm_array_readin_gen *__pyx_v_self) {
PyObject *__pyx_r = NULL;
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("pysndlib.clm.array_readin_gen.mus_increment.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
5435: def mus_increment(self):
+5436: return self._direction
__Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->_direction); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5436, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
5437:
+5438: @mus_increment.setter
/* Python wrapper */
static int __pyx_pw_8pysndlib_3clm_16array_readin_gen_13mus_increment_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_v); /*proto*/
static int __pyx_pw_8pysndlib_3clm_16array_readin_gen_13mus_increment_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_v) {
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
int __pyx_r;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_v), (&PyInt_Type), 0, "v", 1))) __PYX_ERR(0, 5439, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_16array_readin_gen_13mus_increment_2__set__(((struct __pyx_obj_8pysndlib_3clm_array_readin_gen *)__pyx_v_self), ((PyObject*)__pyx_v_v));
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = -1;
__pyx_L0:;
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static int __pyx_pf_8pysndlib_3clm_16array_readin_gen_13mus_increment_2__set__(struct __pyx_obj_8pysndlib_3clm_array_readin_gen *__pyx_v_self, PyObject *__pyx_v_v) {
int __pyx_r;
/* … */
/* function exit code */
__pyx_r = 0;
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_AddTraceback("pysndlib.clm.array_readin_gen.mus_increment.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = -1;
__pyx_L0:;
return __pyx_r;
}
5439: def mus_increment(self, v: int):
+5440: self._direction = v
__pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_v); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 5440, __pyx_L1_error) __pyx_v_self->_direction = __pyx_t_1;
5441:
+5442: @property
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_16array_readin_gen_10mus_length_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8pysndlib_3clm_16array_readin_gen_10mus_length_1__get__(PyObject *__pyx_v_self) {
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
__pyx_r = __pyx_pf_8pysndlib_3clm_16array_readin_gen_10mus_length___get__(((struct __pyx_obj_8pysndlib_3clm_array_readin_gen *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_16array_readin_gen_10mus_length___get__(struct __pyx_obj_8pysndlib_3clm_array_readin_gen *__pyx_v_self) {
PyObject *__pyx_r = NULL;
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("pysndlib.clm.array_readin_gen.mus_length.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
5443: def mus_length(self):
+5444: return self._length
__Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyInt_From_PY_LONG_LONG(__pyx_v_self->_length); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5444, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
5445:
+5446: def __call__(self):
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_16array_readin_gen_3__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_8pysndlib_3clm_16array_readin_gen_3__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__call__ (wrapper)", 0);
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
if (unlikely(__pyx_nargs > 0)) {
__Pyx_RaiseArgtupleInvalid("__call__", 1, 0, 0, __pyx_nargs); return NULL;}
if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_VARARGS(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__call__", 0))) return NULL;
__pyx_r = __pyx_pf_8pysndlib_3clm_16array_readin_gen_2__call__(((struct __pyx_obj_8pysndlib_3clm_array_readin_gen *)__pyx_v_self));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_16array_readin_gen_2__call__(struct __pyx_obj_8pysndlib_3clm_array_readin_gen *__pyx_v_self) {
PyObject *__pyx_r = NULL;
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_6);
__Pyx_XDECREF(__pyx_t_7);
__Pyx_AddTraceback("pysndlib.clm.array_readin_gen.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
+5447: self._location = max(0, min(self._location, self._length-1))
__pyx_t_1 = (__pyx_v_self->_length - 1);
__pyx_t_2 = __pyx_v_self->_location;
__pyx_t_4 = (__pyx_t_1 < __pyx_t_2);
if (__pyx_t_4) {
__pyx_t_3 = __pyx_t_1;
} else {
__pyx_t_3 = __pyx_t_2;
}
__pyx_t_1 = __pyx_t_3;
__pyx_t_5 = 0;
__pyx_t_4 = (__pyx_t_1 > __pyx_t_5);
if (__pyx_t_4) {
__pyx_t_3 = __pyx_t_1;
} else {
__pyx_t_3 = __pyx_t_5;
}
__pyx_v_self->_location = __pyx_t_3;
+5448: self._val = self._arr[self._chan][self._location]
__pyx_t_6 = __Pyx_GetItemInt(((PyObject *)__pyx_v_self->_arr), __pyx_v_self->_chan, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 5448, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_7 = __Pyx_GetItemInt(__pyx_t_6, __pyx_v_self->_location, PY_LONG_LONG, 1, __Pyx_PyInt_From_PY_LONG_LONG, 0, 1, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 5448, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_8 = __pyx_PyFloat_AsFloat(__pyx_t_7); if (unlikely((__pyx_t_8 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 5448, __pyx_L1_error) __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_v_self->_val = __pyx_t_8;
+5449: self._location += self._direction
__pyx_v_self->_location = (__pyx_v_self->_location + __pyx_v_self->_direction);
+5450: return self._val
__Pyx_XDECREF(__pyx_r); __pyx_t_7 = PyFloat_FromDouble(__pyx_v_self->_val); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 5450, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_r = __pyx_t_7; __pyx_t_7 = 0; goto __pyx_L0;
5451:
+5452: cpdef array_readin_gen make_array_readin(arr: npt.NDArray[np.float64], chan: Optional[int]=0, start: Optional[int]=0, direction: Optional[int]=1):
static PyObject *__pyx_pw_8pysndlib_3clm_585make_array_readin(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static struct __pyx_obj_8pysndlib_3clm_array_readin_gen *__pyx_f_8pysndlib_3clm_make_array_readin(PyObject *__pyx_v_arr, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_8pysndlib_3clm_make_array_readin *__pyx_optional_args) {
PyObject *__pyx_v_chan = ((PyObject *)__pyx_int_0);
PyObject *__pyx_v_start = ((PyObject *)__pyx_int_0);
PyObject *__pyx_v_direction = ((PyObject *)__pyx_int_1);
struct __pyx_obj_8pysndlib_3clm_array_readin_gen *__pyx_r = NULL;
if (__pyx_optional_args) {
if (__pyx_optional_args->__pyx_n > 0) {
__pyx_v_chan = __pyx_optional_args->chan;
if (__pyx_optional_args->__pyx_n > 1) {
__pyx_v_start = __pyx_optional_args->start;
if (__pyx_optional_args->__pyx_n > 2) {
__pyx_v_direction = __pyx_optional_args->direction;
}
}
}
}
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("pysndlib.clm.make_array_readin", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XGIVEREF((PyObject *)__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_585make_array_readin(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_8pysndlib_3clm_585make_array_readin = {"make_array_readin", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_585make_array_readin, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_8pysndlib_3clm_585make_array_readin(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
PyObject *__pyx_v_arr = 0;
PyObject *__pyx_v_chan = 0;
PyObject *__pyx_v_start = 0;
PyObject *__pyx_v_direction = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("make_array_readin (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_arr,&__pyx_n_s_chan,&__pyx_n_s_start,&__pyx_n_s_direction,0};
PyObject* values[4] = {0,0,0,0};
values[1] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)__pyx_int_0));
values[2] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)__pyx_int_0));
values[3] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)__pyx_int_1));
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
CYTHON_FALLTHROUGH;
case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_arr)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 5452, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_chan);
if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 5452, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 2:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_start);
if (value) { values[2] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 5452, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 3:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_direction);
if (value) { values[3] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 5452, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "make_array_readin") < 0)) __PYX_ERR(0, 5452, __pyx_L3_error)
}
} else {
switch (__pyx_nargs) {
case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
CYTHON_FALLTHROUGH;
case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
break;
default: goto __pyx_L5_argtuple_error;
}
}
__pyx_v_arr = values[0];
__pyx_v_chan = values[1];
__pyx_v_start = values[2];
__pyx_v_direction = values[3];
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("make_array_readin", 0, 1, 4, __pyx_nargs); __PYX_ERR(0, 5452, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.make_array_readin", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_8pysndlib_3clm_584make_array_readin(__pyx_self, __pyx_v_arr, __pyx_v_chan, __pyx_v_start, __pyx_v_direction);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_584make_array_readin(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_arr, PyObject *__pyx_v_chan, PyObject *__pyx_v_start, PyObject *__pyx_v_direction) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_2.__pyx_n = 3;
__pyx_t_2.chan = __pyx_v_chan;
__pyx_t_2.start = __pyx_v_start;
__pyx_t_2.direction = __pyx_v_direction;
__pyx_t_1 = ((PyObject *)__pyx_f_8pysndlib_3clm_make_array_readin(__pyx_v_arr, 0, &__pyx_t_2)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5452, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("pysndlib.clm.make_array_readin", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_tuple__618 = PyTuple_Pack(4, __pyx_n_s_arr, __pyx_n_s_chan, __pyx_n_s_start, __pyx_n_s_direction); if (unlikely(!__pyx_tuple__618)) __PYX_ERR(0, 5452, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__618);
__Pyx_GIVEREF(__pyx_tuple__618);
__pyx_codeobj__619 = (PyObject*)__Pyx_PyCode_New(4, 0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__618, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_make_array_readin, 5452, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__619)) __PYX_ERR(0, 5452, __pyx_L1_error)
/* … */
__pyx_t_40 = __Pyx_PyDict_NewPresized(4); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 5452, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
if (PyDict_SetItem(__pyx_t_40, __pyx_n_s_arr, __pyx_kp_s_npt_NDArray_np_float64) < 0) __PYX_ERR(0, 5452, __pyx_L1_error)
if (PyDict_SetItem(__pyx_t_40, __pyx_n_s_chan, __pyx_kp_s_Optional_int) < 0) __PYX_ERR(0, 5452, __pyx_L1_error)
if (PyDict_SetItem(__pyx_t_40, __pyx_n_s_start, __pyx_kp_s_Optional_int) < 0) __PYX_ERR(0, 5452, __pyx_L1_error)
if (PyDict_SetItem(__pyx_t_40, __pyx_n_s_direction, __pyx_kp_s_Optional_int) < 0) __PYX_ERR(0, 5452, __pyx_L1_error)
__pyx_t_43 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_585make_array_readin, 0, __pyx_n_s_make_array_readin, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__619)); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 5452, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
__Pyx_CyFunction_SetDefaultsTuple(__pyx_t_43, __pyx_tuple__620);
__Pyx_CyFunction_SetAnnotationsDict(__pyx_t_43, __pyx_t_40);
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
if (PyDict_SetItem(__pyx_d, __pyx_n_s_make_array_readin, __pyx_t_43) < 0) __PYX_ERR(0, 5452, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
__pyx_tuple__620 = PyTuple_Pack(3, __pyx_int_0, __pyx_int_0, __pyx_int_1); if (unlikely(!__pyx_tuple__620)) __PYX_ERR(0, 5452, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__620);
__Pyx_GIVEREF(__pyx_tuple__620);
/* … */
struct __pyx_opt_args_8pysndlib_3clm_make_array_readin {
int __pyx_n;
PyObject *chan;
PyObject *start;
PyObject *direction;
};
+5453: return array_readin_gen(arr, chan, start, direction)
__Pyx_XDECREF((PyObject *)__pyx_r); __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5453, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_v_arr); __Pyx_GIVEREF(__pyx_v_arr); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_arr)) __PYX_ERR(0, 5453, __pyx_L1_error); __Pyx_INCREF(__pyx_v_chan); __Pyx_GIVEREF(__pyx_v_chan); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_chan)) __PYX_ERR(0, 5453, __pyx_L1_error); __Pyx_INCREF(__pyx_v_start); __Pyx_GIVEREF(__pyx_v_start); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_start)) __PYX_ERR(0, 5453, __pyx_L1_error); __Pyx_INCREF(__pyx_v_direction); __Pyx_GIVEREF(__pyx_v_direction); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_v_direction)) __PYX_ERR(0, 5453, __pyx_L1_error); __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8pysndlib_3clm_array_readin_gen), __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 5453, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_r = ((struct __pyx_obj_8pysndlib_3clm_array_readin_gen *)__pyx_t_2); __pyx_t_2 = 0; goto __pyx_L0;
5454:
+5455: cpdef array_readin(gen: array_readin_gen):
static PyObject *__pyx_pw_8pysndlib_3clm_587array_readin(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyObject *__pyx_f_8pysndlib_3clm_array_readin(struct __pyx_obj_8pysndlib_3clm_array_readin_gen *__pyx_v_gen, CYTHON_UNUSED int __pyx_skip_dispatch) {
PyObject *__pyx_r = NULL;
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_AddTraceback("pysndlib.clm.array_readin", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_587array_readin(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_8pysndlib_3clm_587array_readin = {"array_readin", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_587array_readin, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_8pysndlib_3clm_587array_readin(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
struct __pyx_obj_8pysndlib_3clm_array_readin_gen *__pyx_v_gen = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("array_readin (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gen,0};
PyObject* values[1] = {0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_gen)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 5455, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "array_readin") < 0)) __PYX_ERR(0, 5455, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 1)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
}
__pyx_v_gen = ((struct __pyx_obj_8pysndlib_3clm_array_readin_gen *)values[0]);
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("array_readin", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 5455, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.array_readin", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gen), __pyx_ptype_8pysndlib_3clm_array_readin_gen, 0, "gen", 0))) __PYX_ERR(0, 5455, __pyx_L1_error)
__pyx_r = __pyx_pf_8pysndlib_3clm_586array_readin(__pyx_self, __pyx_v_gen);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_586array_readin(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_8pysndlib_3clm_array_readin_gen *__pyx_v_gen) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8pysndlib_3clm_array_readin(__pyx_v_gen, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5455, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("pysndlib.clm.array_readin", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_43 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 5455, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
if (PyDict_SetItem(__pyx_t_43, __pyx_n_s_gen, __pyx_n_s_array_readin_gen) < 0) __PYX_ERR(0, 5455, __pyx_L1_error)
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_587array_readin, 0, __pyx_n_s_array_readin, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__621)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 5455, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
__Pyx_CyFunction_SetAnnotationsDict(__pyx_t_40, __pyx_t_43);
__Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0;
if (PyDict_SetItem(__pyx_d, __pyx_n_s_array_readin, __pyx_t_40) < 0) __PYX_ERR(0, 5455, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
/* … */
__pyx_codeobj__621 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__56, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_array_readin, 5455, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__621)) __PYX_ERR(0, 5455, __pyx_L1_error)
+5456: return gen()
__Pyx_XDECREF(__pyx_r); __Pyx_INCREF((PyObject *)__pyx_v_gen); __pyx_t_2 = ((PyObject *)__pyx_v_gen); __pyx_t_3 = NULL; __pyx_t_4 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_2))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); __pyx_t_4 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL}; __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 0+__pyx_t_4); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5456, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
5457:
+5458: cpdef is_array_readin(gen):
static PyObject *__pyx_pw_8pysndlib_3clm_589is_array_readin(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyObject *__pyx_f_8pysndlib_3clm_is_array_readin(PyObject *__pyx_v_gen, CYTHON_UNUSED int __pyx_skip_dispatch) {
PyObject *__pyx_r = NULL;
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("pysndlib.clm.is_array_readin", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_589is_array_readin(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_8pysndlib_3clm_589is_array_readin = {"is_array_readin", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_589is_array_readin, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_8pysndlib_3clm_589is_array_readin(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
PyObject *__pyx_v_gen = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("is_array_readin (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gen,0};
PyObject* values[1] = {0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_gen)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 5458, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "is_array_readin") < 0)) __PYX_ERR(0, 5458, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 1)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
}
__pyx_v_gen = values[0];
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("is_array_readin", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 5458, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.is_array_readin", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_8pysndlib_3clm_588is_array_readin(__pyx_self, __pyx_v_gen);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_588is_array_readin(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_gen) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_8pysndlib_3clm_is_array_readin(__pyx_v_gen, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5458, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("pysndlib.clm.is_array_readin", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_589is_array_readin, 0, __pyx_n_s_is_array_readin, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__622)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 5458, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_is_array_readin, __pyx_t_40) < 0) __PYX_ERR(0, 5458, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
/* … */
__pyx_codeobj__622 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__56, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_is_array_readin, 5458, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__622)) __PYX_ERR(0, 5458, __pyx_L1_error)
+5459: return isinstance(gen, array_readin_gen)
__Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_gen, __pyx_ptype_8pysndlib_3clm_array_readin_gen); __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 5459, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0;
5460:
5461:
5462:
5463:
5464:
5465:
5466:
5467:
5468: # # todo: maybe add an exception that have to use keyword args
+5469: def make_generator(name, slots, wrapper=None, methods=None, docstring=None):
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_591make_generator(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_8pysndlib_3clm_591make_generator = {"make_generator", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_591make_generator, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_8pysndlib_3clm_591make_generator(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
PyObject *__pyx_v_name = 0;
PyObject *__pyx_v_slots = 0;
PyObject *__pyx_v_wrapper = 0;
PyObject *__pyx_v_methods = 0;
PyObject *__pyx_v_docstring = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("make_generator (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_name,&__pyx_n_s_slots,&__pyx_n_s_wrapper,&__pyx_n_s_methods,&__pyx_n_s_docstring,0};
PyObject* values[5] = {0,0,0,0,0};
values[2] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
values[3] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
values[4] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4);
CYTHON_FALLTHROUGH;
case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
CYTHON_FALLTHROUGH;
case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_name)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 5469, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_slots)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 5469, __pyx_L3_error)
else {
__Pyx_RaiseArgtupleInvalid("make_generator", 0, 2, 5, 1); __PYX_ERR(0, 5469, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 2:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_wrapper);
if (value) { values[2] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 5469, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 3:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_methods);
if (value) { values[3] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 5469, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 4:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_docstring);
if (value) { values[4] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 5469, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "make_generator") < 0)) __PYX_ERR(0, 5469, __pyx_L3_error)
}
} else {
switch (__pyx_nargs) {
case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4);
CYTHON_FALLTHROUGH;
case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
CYTHON_FALLTHROUGH;
case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
break;
default: goto __pyx_L5_argtuple_error;
}
}
__pyx_v_name = values[0];
__pyx_v_slots = values[1];
__pyx_v_wrapper = values[2];
__pyx_v_methods = values[3];
__pyx_v_docstring = values[4];
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("make_generator", 0, 2, 5, __pyx_nargs); __PYX_ERR(0, 5469, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.make_generator", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_8pysndlib_3clm_590make_generator(__pyx_self, __pyx_v_name, __pyx_v_slots, __pyx_v_wrapper, __pyx_v_methods, __pyx_v_docstring);
/* function exit code */
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
static PyObject *__pyx_pf_8pysndlib_3clm_590make_generator(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_name, PyObject *__pyx_v_slots, PyObject *__pyx_v_wrapper, PyObject *__pyx_v_methods, PyObject *__pyx_v_docstring) {
struct __pyx_obj_8pysndlib_3clm___pyx_scope_struct_5_make_generator *__pyx_cur_scope;
PyObject *__pyx_v_make_generator = 0;
PyObject *__pyx_v_is_a = 0;
PyObject *__pyx_v_g = NULL;
PyObject *__pyx_r = NULL;
__pyx_cur_scope = (struct __pyx_obj_8pysndlib_3clm___pyx_scope_struct_5_make_generator *)__pyx_tp_new_8pysndlib_3clm___pyx_scope_struct_5_make_generator(__pyx_ptype_8pysndlib_3clm___pyx_scope_struct_5_make_generator, __pyx_empty_tuple, NULL);
if (unlikely(!__pyx_cur_scope)) {
__pyx_cur_scope = ((struct __pyx_obj_8pysndlib_3clm___pyx_scope_struct_5_make_generator *)Py_None);
__Pyx_INCREF(Py_None);
__PYX_ERR(0, 5469, __pyx_L1_error)
} else {
__Pyx_GOTREF((PyObject *)__pyx_cur_scope);
}
__pyx_cur_scope->__pyx_v_name = __pyx_v_name;
__Pyx_INCREF(__pyx_cur_scope->__pyx_v_name);
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_name);
__pyx_cur_scope->__pyx_v_wrapper = __pyx_v_wrapper;
__Pyx_INCREF(__pyx_cur_scope->__pyx_v_wrapper);
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_wrapper);
__pyx_cur_scope->__pyx_v_methods = __pyx_v_methods;
__Pyx_INCREF(__pyx_cur_scope->__pyx_v_methods);
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_methods);
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_AddTraceback("pysndlib.clm.make_generator", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XDECREF(__pyx_v_make_generator);
__Pyx_XDECREF(__pyx_v_is_a);
__Pyx_XDECREF(__pyx_v_g);
__Pyx_DECREF((PyObject *)__pyx_cur_scope);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_tuple__623 = PyTuple_Pack(11, __pyx_n_s_name, __pyx_n_s_slots, __pyx_n_s_wrapper, __pyx_n_s_methods, __pyx_n_s_docstring, __pyx_n_s_mus_gen, __pyx_n_s_make_generator, __pyx_n_s_make_generator, __pyx_n_s_is_a, __pyx_n_s_is_a, __pyx_n_s_g); if (unlikely(!__pyx_tuple__623)) __PYX_ERR(0, 5469, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__623);
__Pyx_GIVEREF(__pyx_tuple__623);
/* … */
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_591make_generator, 0, __pyx_n_s_make_generator, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__624)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 5469, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
__Pyx_CyFunction_SetDefaultsTuple(__pyx_t_40, __pyx_tuple__67);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_make_generator, __pyx_t_40) < 0) __PYX_ERR(0, 5469, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
__pyx_codeobj__624 = (PyObject*)__Pyx_PyCode_New(5, 0, 0, 11, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__623, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_make_generator, 5469, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__624)) __PYX_ERR(0, 5469, __pyx_L1_error)
/* … */
struct __pyx_obj_8pysndlib_3clm___pyx_scope_struct_5_make_generator {
PyObject_HEAD
PyObject *__pyx_v_methods;
PyObject *__pyx_v_mus_gen;
PyObject *__pyx_v_name;
PyObject *__pyx_v_wrapper;
};
+5470: class mus_gen():
__pyx_t_1 = __Pyx_Py3MetaclassPrepare((PyObject *) NULL, __pyx_empty_tuple, __pyx_n_s_mus_gen, __pyx_n_s_make_generator_locals_mus_gen, (PyObject *) NULL, __pyx_n_s_pysndlib_clm, (PyObject *) NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5470, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_Py3ClassCreate(((PyObject*)&PyType_Type), __pyx_n_s_mus_gen, __pyx_empty_tuple, __pyx_t_1, NULL, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 5470, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_cur_scope->__pyx_v_mus_gen = __pyx_t_2; __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5471: pass
+5472: def make_generator(**kwargs):
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_14make_generator_1make_generator(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_8pysndlib_3clm_14make_generator_1make_generator = {"make_generator", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_14make_generator_1make_generator, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_8pysndlib_3clm_14make_generator_1make_generator(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
PyObject *__pyx_v_kwargs = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("make_generator (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
if (unlikely(__pyx_nargs > 0)) {
__Pyx_RaiseArgtupleInvalid("make_generator", 1, 0, 0, __pyx_nargs); return NULL;}
if (__pyx_kwds && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "make_generator", 1))) return NULL;
if (__pyx_kwds) {
__pyx_v_kwargs = __Pyx_KwargsAsDict_FASTCALL(__pyx_kwds, __pyx_kwvalues);
if (unlikely(!__pyx_v_kwargs)) return NULL;
__Pyx_GOTREF(__pyx_v_kwargs);
} else {
__pyx_v_kwargs = PyDict_New();
if (unlikely(!__pyx_v_kwargs)) return NULL;
__Pyx_GOTREF(__pyx_v_kwargs);
}
__pyx_r = __pyx_pf_8pysndlib_3clm_14make_generator_make_generator(__pyx_self, __pyx_v_kwargs);
/* function exit code */
__Pyx_DECREF(__pyx_v_kwargs);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_14make_generator_make_generator(PyObject *__pyx_self, PyObject *__pyx_v_kwargs) {
struct __pyx_obj_8pysndlib_3clm___pyx_scope_struct_5_make_generator *__pyx_cur_scope;
struct __pyx_obj_8pysndlib_3clm___pyx_scope_struct_5_make_generator *__pyx_outer_scope;
PyObject *__pyx_v_gen = NULL;
PyObject *__pyx_v_k = NULL;
PyObject *__pyx_v_v = NULL;
PyObject *__pyx_r = NULL;
__pyx_outer_scope = (struct __pyx_obj_8pysndlib_3clm___pyx_scope_struct_5_make_generator *) __Pyx_CyFunction_GetClosure(__pyx_self);
__pyx_cur_scope = __pyx_outer_scope;
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_6);
__Pyx_XDECREF(__pyx_t_7);
__Pyx_XDECREF(__pyx_t_10);
__Pyx_XDECREF(__pyx_t_11);
__Pyx_AddTraceback("pysndlib.clm.make_generator.make_generator", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XDECREF(__pyx_v_gen);
__Pyx_XDECREF(__pyx_v_k);
__Pyx_XDECREF(__pyx_v_v);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_tuple__68 = PyTuple_Pack(4, __pyx_n_s_kwargs, __pyx_n_s_gen, __pyx_n_s_k, __pyx_n_s_v); if (unlikely(!__pyx_tuple__68)) __PYX_ERR(0, 5472, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__68);
__Pyx_GIVEREF(__pyx_tuple__68);
/* … */
__pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_14make_generator_1make_generator, 0, __pyx_n_s_make_generator_locals_make_gener, ((PyObject*)__pyx_cur_scope), __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__69)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5472, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_v_make_generator = __pyx_t_1;
__pyx_t_1 = 0;
__pyx_codeobj__69 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_VARKEYWORDS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__68, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_make_generator, 5472, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__69)) __PYX_ERR(0, 5472, __pyx_L1_error)
+5473: gen = mus_gen()
if (unlikely(!__pyx_cur_scope->__pyx_v_mus_gen)) { __Pyx_RaiseClosureNameError("mus_gen"); __PYX_ERR(0, 5473, __pyx_L1_error) }
__pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_cur_scope->__pyx_v_mus_gen); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5473, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_v_gen = __pyx_t_1;
__pyx_t_1 = 0;
+5474: setattr(gen, 'name', name)
if (unlikely(!__pyx_cur_scope->__pyx_v_name)) { __Pyx_RaiseClosureNameError("name"); __PYX_ERR(0, 5474, __pyx_L1_error) }
__pyx_t_1 = __pyx_cur_scope->__pyx_v_name;
__Pyx_INCREF(__pyx_t_1);
__pyx_t_2 = PyObject_SetAttr(__pyx_v_gen, __pyx_n_s_name, __pyx_t_1); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 5474, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+5475: for k, v in kwargs.items():
__pyx_t_3 = 0; __pyx_t_6 = __Pyx_dict_iterator(__pyx_v_kwargs, 1, __pyx_n_s_items, (&__pyx_t_4), (&__pyx_t_5)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 5475, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = __pyx_t_6; __pyx_t_6 = 0; while (1) { __pyx_t_8 = __Pyx_dict_iter_next(__pyx_t_1, __pyx_t_4, &__pyx_t_3, &__pyx_t_6, &__pyx_t_7, NULL, __pyx_t_5); if (unlikely(__pyx_t_8 == 0)) break; if (unlikely(__pyx_t_8 == -1)) __PYX_ERR(0, 5475, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_GOTREF(__pyx_t_7); __Pyx_XDECREF_SET(__pyx_v_k, __pyx_t_6); __pyx_t_6 = 0; __Pyx_XDECREF_SET(__pyx_v_v, __pyx_t_7); __pyx_t_7 = 0;
+5476: setattr(gen, k, v)
__pyx_t_2 = PyObject_SetAttr(__pyx_v_gen, __pyx_v_k, __pyx_v_v); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 5476, __pyx_L1_error) } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+5477: if methods:
if (unlikely(!__pyx_cur_scope->__pyx_v_methods)) { __Pyx_RaiseClosureNameError("methods"); __PYX_ERR(0, 5477, __pyx_L1_error) }
__pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_cur_scope->__pyx_v_methods); if (unlikely((__pyx_t_9 < 0))) __PYX_ERR(0, 5477, __pyx_L1_error)
if (__pyx_t_9) {
/* … */
}
+5478: for k, v in methods.items():
__pyx_t_4 = 0;
if (unlikely(!__pyx_cur_scope->__pyx_v_methods)) { __Pyx_RaiseClosureNameError("methods"); __PYX_ERR(0, 5478, __pyx_L1_error) }
if (unlikely(__pyx_cur_scope->__pyx_v_methods == Py_None)) {
PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "items");
__PYX_ERR(0, 5478, __pyx_L1_error)
}
__pyx_t_7 = __Pyx_dict_iterator(__pyx_cur_scope->__pyx_v_methods, 0, __pyx_n_s_items, (&__pyx_t_3), (&__pyx_t_5)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 5478, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_7);
__Pyx_XDECREF(__pyx_t_1);
__pyx_t_1 = __pyx_t_7;
__pyx_t_7 = 0;
while (1) {
__pyx_t_8 = __Pyx_dict_iter_next(__pyx_t_1, __pyx_t_3, &__pyx_t_4, &__pyx_t_7, &__pyx_t_6, NULL, __pyx_t_5);
if (unlikely(__pyx_t_8 == 0)) break;
if (unlikely(__pyx_t_8 == -1)) __PYX_ERR(0, 5478, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_7);
__Pyx_GOTREF(__pyx_t_6);
__Pyx_XDECREF_SET(__pyx_v_k, __pyx_t_7);
__pyx_t_7 = 0;
__Pyx_XDECREF_SET(__pyx_v_v, __pyx_t_6);
__pyx_t_6 = 0;
+5479: setattr(mus_gen, k, property(v[0], v[1], None) )
if (unlikely(!__pyx_cur_scope->__pyx_v_mus_gen)) { __Pyx_RaiseClosureNameError("mus_gen"); __PYX_ERR(0, 5479, __pyx_L1_error) }
__pyx_t_6 = __pyx_cur_scope->__pyx_v_mus_gen;
__Pyx_INCREF(__pyx_t_6);
__pyx_t_7 = __Pyx_GetItemInt(__pyx_v_v, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 5479, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_7);
__pyx_t_10 = __Pyx_GetItemInt(__pyx_v_v, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 5479, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_10);
__pyx_t_11 = PyTuple_New(3); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 5479, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_11);
__Pyx_GIVEREF(__pyx_t_7);
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_7)) __PYX_ERR(0, 5479, __pyx_L1_error);
__Pyx_GIVEREF(__pyx_t_10);
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_10)) __PYX_ERR(0, 5479, __pyx_L1_error);
__Pyx_INCREF(Py_None);
__Pyx_GIVEREF(Py_None);
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_11, 2, Py_None)) __PYX_ERR(0, 5479, __pyx_L1_error);
__pyx_t_7 = 0;
__pyx_t_10 = 0;
__pyx_t_10 = __Pyx_PyObject_Call(__pyx_builtin_property, __pyx_t_11, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 5479, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_10);
__Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
__pyx_t_2 = PyObject_SetAttr(__pyx_t_6, __pyx_v_k, __pyx_t_10); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 5479, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
__Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5480:
+5481: return gen if not wrapper else wrapper(gen)
__Pyx_XDECREF(__pyx_r); if (unlikely(!__pyx_cur_scope->__pyx_v_wrapper)) { __Pyx_RaiseClosureNameError("wrapper"); __PYX_ERR(0, 5481, __pyx_L1_error) } __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_cur_scope->__pyx_v_wrapper); if (unlikely((__pyx_t_9 < 0))) __PYX_ERR(0, 5481, __pyx_L1_error) __pyx_t_12 = (!__pyx_t_9); if (__pyx_t_12) { __Pyx_INCREF(__pyx_v_gen); __pyx_t_1 = __pyx_v_gen; } else { if (unlikely(!__pyx_cur_scope->__pyx_v_wrapper)) { __Pyx_RaiseClosureNameError("wrapper"); __PYX_ERR(0, 5481, __pyx_L1_error) } __Pyx_INCREF(__pyx_cur_scope->__pyx_v_wrapper); __pyx_t_6 = __pyx_cur_scope->__pyx_v_wrapper; __pyx_t_11 = NULL; __pyx_t_5 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_6))) { __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_6); if (likely(__pyx_t_11)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); __Pyx_INCREF(__pyx_t_11); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_6, function); __pyx_t_5 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_11, __pyx_v_gen}; __pyx_t_10 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5); __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 5481, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; } __pyx_t_1 = __pyx_t_10; __pyx_t_10 = 0; } __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
+5482: def is_a(gen):
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_14make_generator_3is_a(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_8pysndlib_3clm_14make_generator_3is_a = {"is_a", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_14make_generator_3is_a, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_8pysndlib_3clm_14make_generator_3is_a(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
PyObject *__pyx_v_gen = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("is_a (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gen,0};
PyObject* values[1] = {0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_gen)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 5482, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "is_a") < 0)) __PYX_ERR(0, 5482, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 1)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
}
__pyx_v_gen = values[0];
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("is_a", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 5482, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.make_generator.is_a", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_8pysndlib_3clm_14make_generator_2is_a(__pyx_self, __pyx_v_gen);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_14make_generator_2is_a(PyObject *__pyx_self, PyObject *__pyx_v_gen) {
struct __pyx_obj_8pysndlib_3clm___pyx_scope_struct_5_make_generator *__pyx_cur_scope;
struct __pyx_obj_8pysndlib_3clm___pyx_scope_struct_5_make_generator *__pyx_outer_scope;
PyObject *__pyx_r = NULL;
__pyx_outer_scope = (struct __pyx_obj_8pysndlib_3clm___pyx_scope_struct_5_make_generator *) __Pyx_CyFunction_GetClosure(__pyx_self);
__pyx_cur_scope = __pyx_outer_scope;
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_AddTraceback("pysndlib.clm.make_generator.is_a", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_14make_generator_3is_a, 0, __pyx_n_s_make_generator_locals_is_a, ((PyObject*)__pyx_cur_scope), __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__70)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5482, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_v_is_a = __pyx_t_1;
__pyx_t_1 = 0;
/* … */
__pyx_codeobj__70 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__56, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_is_a, 5482, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__70)) __PYX_ERR(0, 5482, __pyx_L1_error)
+5483: return isinstance(gen, mus_gen) and gen.name == name
__Pyx_XDECREF(__pyx_r); if (unlikely(!__pyx_cur_scope->__pyx_v_mus_gen)) { __Pyx_RaiseClosureNameError("mus_gen"); __PYX_ERR(0, 5483, __pyx_L1_error) } __pyx_t_2 = __pyx_cur_scope->__pyx_v_mus_gen; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = PyObject_IsInstance(__pyx_v_gen, __pyx_t_2); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 5483, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__pyx_t_3) { } else { __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 5483, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_1 = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L3_bool_binop_done; } __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_gen, __pyx_n_s_name); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 5483, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (unlikely(!__pyx_cur_scope->__pyx_v_name)) { __Pyx_RaiseClosureNameError("name"); __PYX_ERR(0, 5483, __pyx_L1_error) } __pyx_t_4 = PyObject_RichCompare(__pyx_t_2, __pyx_cur_scope->__pyx_v_name, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 5483, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_INCREF(__pyx_t_4); __pyx_t_1 = __pyx_t_4; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_L3_bool_binop_done:; __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
+5484: g = functools.partial(make_generator, **slots)
__Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_functools); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5484, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_partial); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 5484, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5484, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_v_make_generator); __Pyx_GIVEREF(__pyx_v_make_generator); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_make_generator)) __PYX_ERR(0, 5484, __pyx_L1_error); if (unlikely(__pyx_v_slots == Py_None)) { PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType"); __PYX_ERR(0, 5484, __pyx_L1_error) } if (likely(PyDict_CheckExact(__pyx_v_slots))) { __pyx_t_3 = PyDict_Copy(__pyx_v_slots); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 5484, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); } else { __pyx_t_3 = __Pyx_PyObject_CallOneArg((PyObject*)&PyDict_Type, __pyx_v_slots); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 5484, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); } __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 5484, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_g = __pyx_t_4; __pyx_t_4 = 0;
+5485: if docstring is not None:
__pyx_t_5 = (__pyx_v_docstring != Py_None);
if (__pyx_t_5) {
/* … */
}
+5486: g.__doc__ = docstring
if (__Pyx_PyObject_SetAttrStr(__pyx_v_g, __pyx_n_s_doc, __pyx_v_docstring) < 0) __PYX_ERR(0, 5486, __pyx_L1_error)
5487:
+5488: return g, is_a
__Pyx_XDECREF(__pyx_r); __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 5488, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_INCREF(__pyx_v_g); __Pyx_GIVEREF(__pyx_v_g); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_g)) __PYX_ERR(0, 5488, __pyx_L1_error); __Pyx_INCREF(__pyx_v_is_a); __Pyx_GIVEREF(__pyx_v_is_a); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_is_a)) __PYX_ERR(0, 5488, __pyx_L1_error); __pyx_r = __pyx_t_4; __pyx_t_4 = 0; goto __pyx_L0;
5489:
5490:
5491:
+5492: def _clip(x, lo, hi):
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_593_clip(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_8pysndlib_3clm_593_clip = {"_clip", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_593_clip, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_8pysndlib_3clm_593_clip(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
PyObject *__pyx_v_x = 0;
PyObject *__pyx_v_lo = 0;
PyObject *__pyx_v_hi = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("_clip (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_lo,&__pyx_n_s_hi,0};
PyObject* values[3] = {0,0,0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_x)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 5492, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_lo)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 5492, __pyx_L3_error)
else {
__Pyx_RaiseArgtupleInvalid("_clip", 1, 3, 3, 1); __PYX_ERR(0, 5492, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 2:
if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_hi)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[2]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 5492, __pyx_L3_error)
else {
__Pyx_RaiseArgtupleInvalid("_clip", 1, 3, 3, 2); __PYX_ERR(0, 5492, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "_clip") < 0)) __PYX_ERR(0, 5492, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 3)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
}
__pyx_v_x = values[0];
__pyx_v_lo = values[1];
__pyx_v_hi = values[2];
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("_clip", 1, 3, 3, __pyx_nargs); __PYX_ERR(0, 5492, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm._clip", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_8pysndlib_3clm_592_clip(__pyx_self, __pyx_v_x, __pyx_v_lo, __pyx_v_hi);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_592_clip(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_x, PyObject *__pyx_v_lo, PyObject *__pyx_v_hi) {
PyObject *__pyx_r = NULL;
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_XDECREF(__pyx_t_5);
__Pyx_AddTraceback("pysndlib.clm._clip", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_tuple__625 = PyTuple_Pack(3, __pyx_n_s_x, __pyx_n_s_lo, __pyx_n_s_hi); if (unlikely(!__pyx_tuple__625)) __PYX_ERR(0, 5492, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__625);
__Pyx_GIVEREF(__pyx_tuple__625);
/* … */
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_593_clip, 0, __pyx_n_s_clip, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__626)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 5492, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_clip, __pyx_t_40) < 0) __PYX_ERR(0, 5492, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
__pyx_codeobj__626 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__625, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_clip, 5492, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__626)) __PYX_ERR(0, 5492, __pyx_L1_error)
+5493: return max(min(x, hi),lo)
__Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_v_lo); __pyx_t_1 = __pyx_v_lo; __Pyx_INCREF(__pyx_v_hi); __pyx_t_2 = __pyx_v_hi; __Pyx_INCREF(__pyx_v_x); __pyx_t_3 = __pyx_v_x; __pyx_t_5 = PyObject_RichCompare(__pyx_t_2, __pyx_t_3, Py_LT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 5493, __pyx_L1_error) __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 5493, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_6) { __Pyx_INCREF(__pyx_t_2); __pyx_t_4 = __pyx_t_2; } else { __Pyx_INCREF(__pyx_t_3); __pyx_t_4 = __pyx_t_3; } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_INCREF(__pyx_t_4); __pyx_t_2 = __pyx_t_4; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, __pyx_t_2, Py_GT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 5493, __pyx_L1_error) __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 5493, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_6) { __Pyx_INCREF(__pyx_t_1); __pyx_t_4 = __pyx_t_1; } else { __Pyx_INCREF(__pyx_t_2); __pyx_t_4 = __pyx_t_2; } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_INCREF(__pyx_t_4); __pyx_r = __pyx_t_4; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; goto __pyx_L0;
5494:
+5495: def clamp(x, lo, hi):
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_595clamp(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_8pysndlib_3clm_595clamp = {"clamp", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_595clamp, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_8pysndlib_3clm_595clamp(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
PyObject *__pyx_v_x = 0;
PyObject *__pyx_v_lo = 0;
PyObject *__pyx_v_hi = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("clamp (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_lo,&__pyx_n_s_hi,0};
PyObject* values[3] = {0,0,0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_x)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 5495, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_lo)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 5495, __pyx_L3_error)
else {
__Pyx_RaiseArgtupleInvalid("clamp", 1, 3, 3, 1); __PYX_ERR(0, 5495, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 2:
if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_hi)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[2]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 5495, __pyx_L3_error)
else {
__Pyx_RaiseArgtupleInvalid("clamp", 1, 3, 3, 2); __PYX_ERR(0, 5495, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "clamp") < 0)) __PYX_ERR(0, 5495, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 3)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
}
__pyx_v_x = values[0];
__pyx_v_lo = values[1];
__pyx_v_hi = values[2];
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("clamp", 1, 3, 3, __pyx_nargs); __PYX_ERR(0, 5495, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.clamp", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_8pysndlib_3clm_594clamp(__pyx_self, __pyx_v_x, __pyx_v_lo, __pyx_v_hi);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_594clamp(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_x, PyObject *__pyx_v_lo, PyObject *__pyx_v_hi) {
PyObject *__pyx_r = NULL;
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_XDECREF(__pyx_t_5);
__Pyx_AddTraceback("pysndlib.clm.clamp", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_595clamp, 0, __pyx_n_s_clamp, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__627)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 5495, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_clamp, __pyx_t_40) < 0) __PYX_ERR(0, 5495, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
/* … */
__pyx_codeobj__627 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__625, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_clamp, 5495, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__627)) __PYX_ERR(0, 5495, __pyx_L1_error)
+5496: return max(min(x, hi),lo)
__Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_v_lo); __pyx_t_1 = __pyx_v_lo; __Pyx_INCREF(__pyx_v_hi); __pyx_t_2 = __pyx_v_hi; __Pyx_INCREF(__pyx_v_x); __pyx_t_3 = __pyx_v_x; __pyx_t_5 = PyObject_RichCompare(__pyx_t_2, __pyx_t_3, Py_LT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 5496, __pyx_L1_error) __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 5496, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_6) { __Pyx_INCREF(__pyx_t_2); __pyx_t_4 = __pyx_t_2; } else { __Pyx_INCREF(__pyx_t_3); __pyx_t_4 = __pyx_t_3; } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_INCREF(__pyx_t_4); __pyx_t_2 = __pyx_t_4; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, __pyx_t_2, Py_GT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 5496, __pyx_L1_error) __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 5496, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_6) { __Pyx_INCREF(__pyx_t_1); __pyx_t_4 = __pyx_t_1; } else { __Pyx_INCREF(__pyx_t_2); __pyx_t_4 = __pyx_t_2; } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_INCREF(__pyx_t_4); __pyx_r = __pyx_t_4; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; goto __pyx_L0;
5497:
+5498: def _wrap(x, lo, hi):
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_597_wrap(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_8pysndlib_3clm_597_wrap = {"_wrap", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_597_wrap, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_8pysndlib_3clm_597_wrap(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
PyObject *__pyx_v_x = 0;
PyObject *__pyx_v_lo = 0;
PyObject *__pyx_v_hi = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("_wrap (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_lo,&__pyx_n_s_hi,0};
PyObject* values[3] = {0,0,0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_x)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 5498, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_lo)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 5498, __pyx_L3_error)
else {
__Pyx_RaiseArgtupleInvalid("_wrap", 1, 3, 3, 1); __PYX_ERR(0, 5498, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 2:
if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_hi)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[2]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 5498, __pyx_L3_error)
else {
__Pyx_RaiseArgtupleInvalid("_wrap", 1, 3, 3, 2); __PYX_ERR(0, 5498, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "_wrap") < 0)) __PYX_ERR(0, 5498, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 3)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
}
__pyx_v_x = values[0];
__pyx_v_lo = values[1];
__pyx_v_hi = values[2];
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("_wrap", 1, 3, 3, __pyx_nargs); __PYX_ERR(0, 5498, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm._wrap", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_8pysndlib_3clm_596_wrap(__pyx_self, __pyx_v_x, __pyx_v_lo, __pyx_v_hi);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_596_wrap(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_x, PyObject *__pyx_v_lo, PyObject *__pyx_v_hi) {
PyObject *__pyx_v_r = NULL;
PyObject *__pyx_r = NULL;
/* … */
/* function exit code */
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_XDECREF(__pyx_t_5);
__Pyx_XDECREF(__pyx_t_6);
__Pyx_AddTraceback("pysndlib.clm._wrap", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XDECREF(__pyx_v_r);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_tuple__628 = PyTuple_Pack(4, __pyx_n_s_x, __pyx_n_s_lo, __pyx_n_s_hi, __pyx_n_s_r); if (unlikely(!__pyx_tuple__628)) __PYX_ERR(0, 5498, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__628);
__Pyx_GIVEREF(__pyx_tuple__628);
/* … */
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_597_wrap, 0, __pyx_n_s_wrap, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__629)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 5498, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_wrap, __pyx_t_40) < 0) __PYX_ERR(0, 5498, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
__pyx_codeobj__629 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__628, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_wrap, 5498, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__629)) __PYX_ERR(0, 5498, __pyx_L1_error)
+5499: r = hi-lo
__pyx_t_1 = PyNumber_Subtract(__pyx_v_hi, __pyx_v_lo); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5499, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_r = __pyx_t_1; __pyx_t_1 = 0;
+5500: if x >= lo and x <= hi:
__pyx_t_1 = PyObject_RichCompare(__pyx_v_x, __pyx_v_lo, Py_GE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5500, __pyx_L1_error) __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 5500, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_3) { } else { __pyx_t_2 = __pyx_t_3; goto __pyx_L4_bool_binop_done; } __pyx_t_1 = PyObject_RichCompare(__pyx_v_x, __pyx_v_hi, Py_LE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5500, __pyx_L1_error) __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 5500, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_2 = __pyx_t_3; __pyx_L4_bool_binop_done:; if (__pyx_t_2) { /* … */ }
+5501: return x
__Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_v_x); __pyx_r = __pyx_v_x; goto __pyx_L0;
+5502: if x < lo:
__pyx_t_1 = PyObject_RichCompare(__pyx_v_x, __pyx_v_lo, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5502, __pyx_L1_error) __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 5502, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_2) { /* … */ }
+5503: return hi + (math.fmod((x-lo), r))
__Pyx_XDECREF(__pyx_r); __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_math); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 5503, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_fmod); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 5503, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = PyNumber_Subtract(__pyx_v_x, __pyx_v_lo); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 5503, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_6 = NULL; __pyx_t_7 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_5))) { __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5); if (likely(__pyx_t_6)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); __Pyx_INCREF(__pyx_t_6); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_5, function); __pyx_t_7 = 1; } } #endif { PyObject *__pyx_callargs[3] = {__pyx_t_6, __pyx_t_4, __pyx_v_r}; __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_7, 2+__pyx_t_7); __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5503, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } __pyx_t_5 = PyNumber_Add(__pyx_v_hi, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 5503, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_r = __pyx_t_5; __pyx_t_5 = 0; goto __pyx_L0;
+5504: if x > hi:
__pyx_t_5 = PyObject_RichCompare(__pyx_v_x, __pyx_v_hi, Py_GT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 5504, __pyx_L1_error) __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 5504, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_2) { /* … */ }
+5505: return lo + (math.fmod((x-hi), r))
__Pyx_XDECREF(__pyx_r); __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_math); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5505, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_fmod); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 5505, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyNumber_Subtract(__pyx_v_x, __pyx_v_hi); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5505, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_6 = NULL; __pyx_t_7 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_4))) { __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_4); if (likely(__pyx_t_6)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); __Pyx_INCREF(__pyx_t_6); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_4, function); __pyx_t_7 = 1; } } #endif { PyObject *__pyx_callargs[3] = {__pyx_t_6, __pyx_t_1, __pyx_v_r}; __pyx_t_5 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_7, 2+__pyx_t_7); __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 5505, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } __pyx_t_4 = PyNumber_Add(__pyx_v_lo, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 5505, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_r = __pyx_t_4; __pyx_t_4 = 0; goto __pyx_L0;
5506:
+5507: def array_reader(arr, chan, loop=False):
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_599array_reader(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_8pysndlib_3clm_599array_reader = {"array_reader", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_599array_reader, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_8pysndlib_3clm_599array_reader(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
PyObject *__pyx_v_arr = 0;
PyObject *__pyx_v_chan = 0;
PyObject *__pyx_v_loop = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("array_reader (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_arr,&__pyx_n_s_chan,&__pyx_n_s_loop,0};
PyObject* values[3] = {0,0,0};
values[2] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)((PyObject *)Py_False)));
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_arr)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 5507, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_chan)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 5507, __pyx_L3_error)
else {
__Pyx_RaiseArgtupleInvalid("array_reader", 0, 2, 3, 1); __PYX_ERR(0, 5507, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 2:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_loop);
if (value) { values[2] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 5507, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "array_reader") < 0)) __PYX_ERR(0, 5507, __pyx_L3_error)
}
} else {
switch (__pyx_nargs) {
case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
break;
default: goto __pyx_L5_argtuple_error;
}
}
__pyx_v_arr = values[0];
__pyx_v_chan = values[1];
__pyx_v_loop = values[2];
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("array_reader", 0, 2, 3, __pyx_nargs); __PYX_ERR(0, 5507, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.array_reader", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_8pysndlib_3clm_598array_reader(__pyx_self, __pyx_v_arr, __pyx_v_chan, __pyx_v_loop);
/* function exit code */
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
static PyObject *__pyx_pf_8pysndlib_3clm_598array_reader(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_arr, PyObject *__pyx_v_chan, PyObject *__pyx_v_loop) {
struct __pyx_obj_8pysndlib_3clm___pyx_scope_struct_6_array_reader *__pyx_cur_scope;
PyObject *__pyx_v_reader = 0;
PyObject *__pyx_r = NULL;
__pyx_cur_scope = (struct __pyx_obj_8pysndlib_3clm___pyx_scope_struct_6_array_reader *)__pyx_tp_new_8pysndlib_3clm___pyx_scope_struct_6_array_reader(__pyx_ptype_8pysndlib_3clm___pyx_scope_struct_6_array_reader, __pyx_empty_tuple, NULL);
if (unlikely(!__pyx_cur_scope)) {
__pyx_cur_scope = ((struct __pyx_obj_8pysndlib_3clm___pyx_scope_struct_6_array_reader *)Py_None);
__Pyx_INCREF(Py_None);
__PYX_ERR(0, 5507, __pyx_L1_error)
} else {
__Pyx_GOTREF((PyObject *)__pyx_cur_scope);
}
__pyx_cur_scope->__pyx_v_arr = __pyx_v_arr;
__Pyx_INCREF(__pyx_cur_scope->__pyx_v_arr);
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_arr);
__pyx_cur_scope->__pyx_v_chan = __pyx_v_chan;
__Pyx_INCREF(__pyx_cur_scope->__pyx_v_chan);
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_chan);
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_AddTraceback("pysndlib.clm.array_reader", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XDECREF(__pyx_v_reader);
__Pyx_DECREF((PyObject *)__pyx_cur_scope);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_tuple__630 = PyTuple_Pack(8, __pyx_n_s_arr, __pyx_n_s_chan, __pyx_n_s_loop, __pyx_n_s_ind, __pyx_n_s_length, __pyx_n_s_reader, __pyx_n_s_reader, __pyx_n_s_reader); if (unlikely(!__pyx_tuple__630)) __PYX_ERR(0, 5507, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__630);
__Pyx_GIVEREF(__pyx_tuple__630);
__pyx_codeobj__631 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 8, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__630, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_array_reader, 5507, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__631)) __PYX_ERR(0, 5507, __pyx_L1_error)
/* … */
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_599array_reader, 0, __pyx_n_s_array_reader, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__631)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 5507, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
__Pyx_CyFunction_SetDefaultsTuple(__pyx_t_40, __pyx_tuple__632);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_array_reader, __pyx_t_40) < 0) __PYX_ERR(0, 5507, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
__pyx_tuple__632 = PyTuple_Pack(1, ((PyObject *)Py_False)); if (unlikely(!__pyx_tuple__632)) __PYX_ERR(0, 5507, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__632);
__Pyx_GIVEREF(__pyx_tuple__632);
/* … */
struct __pyx_obj_8pysndlib_3clm___pyx_scope_struct_6_array_reader {
PyObject_HEAD
PyObject *__pyx_v_arr;
PyObject *__pyx_v_chan;
PyObject *__pyx_v_ind;
long __pyx_v_length;
};
+5508: ind = 0
__Pyx_INCREF(__pyx_int_0); __Pyx_GIVEREF(__pyx_int_0); __pyx_cur_scope->__pyx_v_ind = __pyx_int_0;
+5509: if chan > (clm_channels(arr)):
__pyx_t_1 = __pyx_cur_scope->__pyx_v_arr; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = __pyx_f_8pysndlib_3clm_clm_channels(__pyx_t_1, 0); if (unlikely(__pyx_t_2 == ((long)-1) && PyErr_Occurred())) __PYX_ERR(0, 5509, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5509, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = PyObject_RichCompare(__pyx_cur_scope->__pyx_v_chan, __pyx_t_1, Py_GT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 5509, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 5509, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(__pyx_t_4)) { /* … */ }
+5510: raise ValueError(f'array has {clm_channels(arr)} channels but {chan} asked for')
__pyx_t_3 = PyTuple_New(5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 5510, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = 0; __pyx_t_6 = 127; __Pyx_INCREF(__pyx_kp_u_array_has); __pyx_t_5 += 10; __Pyx_GIVEREF(__pyx_kp_u_array_has); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_kp_u_array_has); __pyx_t_1 = __pyx_cur_scope->__pyx_v_arr; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = __pyx_f_8pysndlib_3clm_clm_channels(__pyx_t_1, 0); if (unlikely(__pyx_t_2 == ((long)-1) && PyErr_Occurred())) __PYX_ERR(0, 5510, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_PyUnicode_From_long(__pyx_t_2, 0, ' ', 'd'); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5510, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_5 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1); __pyx_t_1 = 0; __Pyx_INCREF(__pyx_kp_u_channels_but); __pyx_t_5 += 14; __Pyx_GIVEREF(__pyx_kp_u_channels_but); PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_kp_u_channels_but); __pyx_t_1 = __Pyx_PyObject_FormatSimple(__pyx_cur_scope->__pyx_v_chan, __pyx_empty_unicode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5510, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_6 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_1) > __pyx_t_6) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_1) : __pyx_t_6; __pyx_t_5 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_3, 3, __pyx_t_1); __pyx_t_1 = 0; __Pyx_INCREF(__pyx_kp_u_asked_for); __pyx_t_5 += 10; __Pyx_GIVEREF(__pyx_kp_u_asked_for); PyTuple_SET_ITEM(__pyx_t_3, 4, __pyx_kp_u_asked_for); __pyx_t_1 = __Pyx_PyUnicode_Join(__pyx_t_3, 5, __pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5510, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 5510, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __PYX_ERR(0, 5510, __pyx_L1_error)
+5511: length = clm_length(arr)
__pyx_t_3 = __pyx_cur_scope->__pyx_v_arr; __Pyx_INCREF(__pyx_t_3); __pyx_t_2 = __pyx_f_8pysndlib_3clm_clm_length(__pyx_t_3, 0); if (unlikely(__pyx_t_2 == ((long)-1) && PyErr_Occurred())) __PYX_ERR(0, 5511, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_cur_scope->__pyx_v_length = __pyx_t_2;
+5512: if loop:
__pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_loop); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 5512, __pyx_L1_error) if (__pyx_t_4) { /* … */ goto __pyx_L4; }
+5513: def reader(direction):
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_12array_reader_1reader(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_8pysndlib_3clm_12array_reader_1reader = {"reader", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_12array_reader_1reader, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_8pysndlib_3clm_12array_reader_1reader(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
PyObject *__pyx_v_direction = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("reader (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_direction,0};
PyObject* values[1] = {0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_direction)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 5513, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "reader") < 0)) __PYX_ERR(0, 5513, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 1)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
}
__pyx_v_direction = values[0];
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("reader", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 5513, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.array_reader.reader", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_8pysndlib_3clm_12array_reader_reader(__pyx_self, __pyx_v_direction);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_12array_reader_reader(PyObject *__pyx_self, PyObject *__pyx_v_direction) {
struct __pyx_obj_8pysndlib_3clm___pyx_scope_struct_6_array_reader *__pyx_cur_scope;
struct __pyx_obj_8pysndlib_3clm___pyx_scope_struct_6_array_reader *__pyx_outer_scope;
PyObject *__pyx_v_v = NULL;
PyObject *__pyx_r = NULL;
__pyx_outer_scope = (struct __pyx_obj_8pysndlib_3clm___pyx_scope_struct_6_array_reader *) __Pyx_CyFunction_GetClosure(__pyx_self);
__pyx_cur_scope = __pyx_outer_scope;
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_AddTraceback("pysndlib.clm.array_reader.reader", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XDECREF(__pyx_v_v);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_tuple__71 = PyTuple_Pack(2, __pyx_n_s_direction, __pyx_n_s_v); if (unlikely(!__pyx_tuple__71)) __PYX_ERR(0, 5513, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__71);
__Pyx_GIVEREF(__pyx_tuple__71);
/* … */
__pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_12array_reader_1reader, 0, __pyx_n_s_array_reader_locals_reader, ((PyObject*)__pyx_cur_scope), __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__72)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 5513, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__pyx_v_reader = __pyx_t_3;
__pyx_t_3 = 0;
__pyx_codeobj__72 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__71, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_reader, 5513, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__72)) __PYX_ERR(0, 5513, __pyx_L1_error)
5514: nonlocal ind
+5515: v = arr[chan][ind]
if (unlikely(!__pyx_cur_scope->__pyx_v_arr)) { __Pyx_RaiseClosureNameError("arr"); __PYX_ERR(0, 5515, __pyx_L1_error) }
if (unlikely(!__pyx_cur_scope->__pyx_v_chan)) { __Pyx_RaiseClosureNameError("chan"); __PYX_ERR(0, 5515, __pyx_L1_error) }
__pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_cur_scope->__pyx_v_arr, __pyx_cur_scope->__pyx_v_chan); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5515, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
if (unlikely(!__pyx_cur_scope->__pyx_v_ind)) { __Pyx_RaiseClosureNameError("ind"); __PYX_ERR(0, 5515, __pyx_L1_error) }
__pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_cur_scope->__pyx_v_ind); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 5515, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_v_v = __pyx_t_2;
__pyx_t_2 = 0;
+5516: ind += direction
if (unlikely(!__pyx_cur_scope->__pyx_v_ind)) { __Pyx_RaiseClosureNameError("ind"); __PYX_ERR(0, 5516, __pyx_L1_error) }
__pyx_t_2 = PyNumber_InPlaceAdd(__pyx_cur_scope->__pyx_v_ind, __pyx_v_direction); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 5516, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_ind);
__Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_ind, __pyx_t_2);
__Pyx_GIVEREF(__pyx_t_2);
__pyx_t_2 = 0;
+5517: ind = _wrap(ind, 0, length-1)
__Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_wrap); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5517, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = __Pyx_PyInt_From_long((__pyx_cur_scope->__pyx_v_length - 1)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 5517, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = NULL; __pyx_t_5 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_1))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_1, function); __pyx_t_5 = 1; } } #endif { PyObject *__pyx_callargs[4] = {__pyx_t_4, __pyx_cur_scope->__pyx_v_ind, __pyx_int_0, __pyx_t_3}; __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_1, __pyx_callargs+1-__pyx_t_5, 3+__pyx_t_5); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 5517, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_ind); __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_ind, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = 0;
+5518: return v
__Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_v_v); __pyx_r = __pyx_v_v; goto __pyx_L0;
5519:
5520: else:
+5521: def reader(direction):
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_12array_reader_3reader(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_8pysndlib_3clm_12array_reader_3reader = {"reader", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_12array_reader_3reader, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_8pysndlib_3clm_12array_reader_3reader(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
PyObject *__pyx_v_direction = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("reader (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_direction,0};
PyObject* values[1] = {0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_direction)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 5521, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "reader") < 0)) __PYX_ERR(0, 5521, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 1)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
}
__pyx_v_direction = values[0];
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("reader", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 5521, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.array_reader.reader", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_8pysndlib_3clm_12array_reader_2reader(__pyx_self, __pyx_v_direction);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_12array_reader_2reader(PyObject *__pyx_self, PyObject *__pyx_v_direction) {
struct __pyx_obj_8pysndlib_3clm___pyx_scope_struct_6_array_reader *__pyx_cur_scope;
struct __pyx_obj_8pysndlib_3clm___pyx_scope_struct_6_array_reader *__pyx_outer_scope;
PyObject *__pyx_v_v = NULL;
PyObject *__pyx_r = NULL;
__pyx_outer_scope = (struct __pyx_obj_8pysndlib_3clm___pyx_scope_struct_6_array_reader *) __Pyx_CyFunction_GetClosure(__pyx_self);
__pyx_cur_scope = __pyx_outer_scope;
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_AddTraceback("pysndlib.clm.array_reader.reader", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XDECREF(__pyx_v_v);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
/*else*/ {
__pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_12array_reader_3reader, 0, __pyx_n_s_array_reader_locals_reader, ((PyObject*)__pyx_cur_scope), __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__73)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 5521, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__pyx_v_reader = __pyx_t_3;
__pyx_t_3 = 0;
}
__pyx_L4:;
/* … */
__pyx_codeobj__73 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__71, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_reader, 5521, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__73)) __PYX_ERR(0, 5521, __pyx_L1_error)
5522: nonlocal ind
+5523: v = arr[chan][ind]
if (unlikely(!__pyx_cur_scope->__pyx_v_arr)) { __Pyx_RaiseClosureNameError("arr"); __PYX_ERR(0, 5523, __pyx_L1_error) }
if (unlikely(!__pyx_cur_scope->__pyx_v_chan)) { __Pyx_RaiseClosureNameError("chan"); __PYX_ERR(0, 5523, __pyx_L1_error) }
__pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_cur_scope->__pyx_v_arr, __pyx_cur_scope->__pyx_v_chan); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5523, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
if (unlikely(!__pyx_cur_scope->__pyx_v_ind)) { __Pyx_RaiseClosureNameError("ind"); __PYX_ERR(0, 5523, __pyx_L1_error) }
__pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_cur_scope->__pyx_v_ind); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 5523, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_v_v = __pyx_t_2;
__pyx_t_2 = 0;
+5524: ind += direction
if (unlikely(!__pyx_cur_scope->__pyx_v_ind)) { __Pyx_RaiseClosureNameError("ind"); __PYX_ERR(0, 5524, __pyx_L1_error) }
__pyx_t_2 = PyNumber_InPlaceAdd(__pyx_cur_scope->__pyx_v_ind, __pyx_v_direction); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 5524, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_ind);
__Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_ind, __pyx_t_2);
__Pyx_GIVEREF(__pyx_t_2);
__pyx_t_2 = 0;
+5525: ind = _clip(ind, 0, length-1)
__Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_clip); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5525, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = __Pyx_PyInt_From_long((__pyx_cur_scope->__pyx_v_length - 1)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 5525, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = NULL; __pyx_t_5 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_1))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_1, function); __pyx_t_5 = 1; } } #endif { PyObject *__pyx_callargs[4] = {__pyx_t_4, __pyx_cur_scope->__pyx_v_ind, __pyx_int_0, __pyx_t_3}; __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_1, __pyx_callargs+1-__pyx_t_5, 3+__pyx_t_5); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 5525, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_ind); __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_ind, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = 0;
+5526: return v
__Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_v_v); __pyx_r = __pyx_v_v; goto __pyx_L0;
+5527: return reader
__Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_v_reader); __pyx_r = __pyx_v_reader; goto __pyx_L0;
5528:
+5529: def sndplay(file):
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_601sndplay(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_8pysndlib_3clm_601sndplay = {"sndplay", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_601sndplay, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_8pysndlib_3clm_601sndplay(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
PyObject *__pyx_v_file = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("sndplay (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_file,0};
PyObject* values[1] = {0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_file)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 5529, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "sndplay") < 0)) __PYX_ERR(0, 5529, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 1)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
}
__pyx_v_file = values[0];
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("sndplay", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 5529, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.sndplay", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_8pysndlib_3clm_600sndplay(__pyx_self, __pyx_v_file);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_600sndplay(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_file) {
PyObject *__pyx_r = NULL;
/* … */
/* function exit code */
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_AddTraceback("pysndlib.clm.sndplay", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_tuple__633 = PyTuple_Pack(1, __pyx_n_s_file); if (unlikely(!__pyx_tuple__633)) __PYX_ERR(0, 5529, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__633);
__Pyx_GIVEREF(__pyx_tuple__633);
/* … */
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_601sndplay, 0, __pyx_n_s_sndplay, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__634)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 5529, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_sndplay, __pyx_t_40) < 0) __PYX_ERR(0, 5529, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
__pyx_codeobj__634 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__633, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_sndplay, 5529, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__634)) __PYX_ERR(0, 5529, __pyx_L1_error)
+5530: subprocess.run([CLM.player,file])
__Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_subprocess); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 5530, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_run); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 5530, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_CLM); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 5530, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_player); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 5530, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = PyList_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 5530, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_GIVEREF(__pyx_t_4); if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 0, __pyx_t_4)) __PYX_ERR(0, 5530, __pyx_L1_error); __Pyx_INCREF(__pyx_v_file); __Pyx_GIVEREF(__pyx_v_file); if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 1, __pyx_v_file)) __PYX_ERR(0, 5530, __pyx_L1_error); __pyx_t_4 = 0; __pyx_t_4 = NULL; __pyx_t_5 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_3))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); __pyx_t_5 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_2}; __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5530, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5531:
5532: #decorator for reverbs.
+5533: def clm_reverb(func):
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_603clm_reverb(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_8pysndlib_3clm_603clm_reverb = {"clm_reverb", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_603clm_reverb, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_8pysndlib_3clm_603clm_reverb(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
PyObject *__pyx_v_func = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("clm_reverb (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_func,0};
PyObject* values[1] = {0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_func)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 5533, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "clm_reverb") < 0)) __PYX_ERR(0, 5533, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 1)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
}
__pyx_v_func = values[0];
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("clm_reverb", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 5533, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.clm_reverb", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_8pysndlib_3clm_602clm_reverb(__pyx_self, __pyx_v_func);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
static PyObject *__pyx_pf_8pysndlib_3clm_602clm_reverb(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_func) {
struct __pyx_obj_8pysndlib_3clm___pyx_scope_struct_7_clm_reverb *__pyx_cur_scope;
PyObject *__pyx_v_call = 0;
PyObject *__pyx_r = NULL;
__pyx_cur_scope = (struct __pyx_obj_8pysndlib_3clm___pyx_scope_struct_7_clm_reverb *)__pyx_tp_new_8pysndlib_3clm___pyx_scope_struct_7_clm_reverb(__pyx_ptype_8pysndlib_3clm___pyx_scope_struct_7_clm_reverb, __pyx_empty_tuple, NULL);
if (unlikely(!__pyx_cur_scope)) {
__pyx_cur_scope = ((struct __pyx_obj_8pysndlib_3clm___pyx_scope_struct_7_clm_reverb *)Py_None);
__Pyx_INCREF(Py_None);
__PYX_ERR(0, 5533, __pyx_L1_error)
} else {
__Pyx_GOTREF((PyObject *)__pyx_cur_scope);
}
__pyx_cur_scope->__pyx_v_func = __pyx_v_func;
__Pyx_INCREF(__pyx_cur_scope->__pyx_v_func);
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_func);
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_AddTraceback("pysndlib.clm.clm_reverb", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XDECREF(__pyx_v_call);
__Pyx_DECREF((PyObject *)__pyx_cur_scope);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_tuple__635 = PyTuple_Pack(3, __pyx_n_s_func, __pyx_n_s_call, __pyx_n_s_call); if (unlikely(!__pyx_tuple__635)) __PYX_ERR(0, 5533, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__635);
__Pyx_GIVEREF(__pyx_tuple__635);
/* … */
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_603clm_reverb, 0, __pyx_n_s_clm_reverb, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__636)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 5533, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_clm_reverb, __pyx_t_40) < 0) __PYX_ERR(0, 5533, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
__pyx_codeobj__636 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__635, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_clm_reverb, 5533, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__636)) __PYX_ERR(0, 5533, __pyx_L1_error)
/* … */
struct __pyx_obj_8pysndlib_3clm___pyx_scope_struct_7_clm_reverb {
PyObject_HEAD
PyObject *__pyx_v_func;
};
+5534: @functools.wraps(func)
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_10clm_reverb_1call(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_8pysndlib_3clm_10clm_reverb_1call = {"call", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_8pysndlib_3clm_10clm_reverb_1call, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_8pysndlib_3clm_10clm_reverb_1call(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_args = 0;
PyObject *__pyx_v_kwargs = 0;
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("call (wrapper)", 0);
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
if (unlikely(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "call", 1))) return NULL;
if (unlikely(__pyx_kwds)) {
__pyx_v_kwargs = __Pyx_KwargsAsDict_VARARGS(__pyx_kwds, __pyx_kwvalues);
if (unlikely(!__pyx_v_kwargs)) return NULL;
__Pyx_GOTREF(__pyx_v_kwargs);
} else {
__pyx_v_kwargs = PyDict_New();
if (unlikely(!__pyx_v_kwargs)) return NULL;
__Pyx_GOTREF(__pyx_v_kwargs);
}
__Pyx_INCREF(__pyx_args);
__pyx_v_args = __pyx_args;
__pyx_r = __pyx_pf_8pysndlib_3clm_10clm_reverb_call(__pyx_self, __pyx_v_args, __pyx_v_kwargs);
/* function exit code */
__Pyx_DECREF(__pyx_v_args);
__Pyx_DECREF(__pyx_v_kwargs);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_10clm_reverb_call(PyObject *__pyx_self, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs) {
struct __pyx_obj_8pysndlib_3clm___pyx_scope_struct_7_clm_reverb *__pyx_cur_scope;
struct __pyx_obj_8pysndlib_3clm___pyx_scope_struct_7_clm_reverb *__pyx_outer_scope;
PyObject *__pyx_r = NULL;
__pyx_outer_scope = (struct __pyx_obj_8pysndlib_3clm___pyx_scope_struct_7_clm_reverb *) __Pyx_CyFunction_GetClosure(__pyx_self);
__pyx_cur_scope = __pyx_outer_scope;
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_AddTraceback("pysndlib.clm.clm_reverb.call", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_functools); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 5534, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_wraps); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 5534, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_3 = NULL;
__pyx_t_5 = 0;
#if CYTHON_UNPACK_METHODS
if (unlikely(PyMethod_Check(__pyx_t_4))) {
__pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
if (likely(__pyx_t_3)) {
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
__Pyx_INCREF(__pyx_t_3);
__Pyx_INCREF(function);
__Pyx_DECREF_SET(__pyx_t_4, function);
__pyx_t_5 = 1;
}
}
#endif
{
PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_cur_scope->__pyx_v_func};
__pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5);
__Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 5534, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
}
/* … */
__pyx_tuple__74 = PyTuple_Pack(2, __pyx_n_s_args, __pyx_n_s_kwargs); if (unlikely(!__pyx_tuple__74)) __PYX_ERR(0, 5534, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__74);
__Pyx_GIVEREF(__pyx_tuple__74);
__pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_10clm_reverb_1call, 0, __pyx_n_s_clm_reverb_locals_call, ((PyObject*)__pyx_cur_scope), __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__75)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 5534, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_4);
__pyx_t_3 = NULL;
__pyx_t_5 = 0;
#if CYTHON_UNPACK_METHODS
if (unlikely(PyMethod_Check(__pyx_t_2))) {
__pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
if (likely(__pyx_t_3)) {
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
__Pyx_INCREF(__pyx_t_3);
__Pyx_INCREF(function);
__Pyx_DECREF_SET(__pyx_t_2, function);
__pyx_t_5 = 1;
}
}
#endif
{
PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_4};
__pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5);
__Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5534, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
}
__pyx_v_call = __pyx_t_1;
__pyx_t_1 = 0;
__pyx_codeobj__75 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_VARARGS|CO_VARKEYWORDS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__74, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_call, 5534, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__75)) __PYX_ERR(0, 5534, __pyx_L1_error)
5535: def call(*args, **kwargs):
+5536: return functools.partial(func,*args, **kwargs)
__Pyx_XDECREF(__pyx_r); __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_functools); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5536, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_partial); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 5536, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (unlikely(!__pyx_cur_scope->__pyx_v_func)) { __Pyx_RaiseClosureNameError("func"); __PYX_ERR(0, 5536, __pyx_L1_error) } __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5536, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_cur_scope->__pyx_v_func); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_func); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_cur_scope->__pyx_v_func)) __PYX_ERR(0, 5536, __pyx_L1_error); __pyx_t_3 = PyNumber_Add(__pyx_t_1, __pyx_v_args); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 5536, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyDict_Copy(__pyx_v_kwargs); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5536, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 5536, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_r = __pyx_t_4; __pyx_t_4 = 0; goto __pyx_L0;
+5537: return call
__Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_v_call); __pyx_r = __pyx_v_call; goto __pyx_L0;
5538:
+5539: def array_resample(arr, new_length, interp_type=Interp.LINEAR):
static PyObject *__pyx_pf_8pysndlib_3clm_635__defaults__(CYTHON_UNUSED PyObject *__pyx_self) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5539, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__Pyx_INCREF(__Pyx_CyFunction_Defaults(__pyx_defaults3, __pyx_self)->__pyx_arg_interp_type);
__Pyx_GIVEREF(__Pyx_CyFunction_Defaults(__pyx_defaults3, __pyx_self)->__pyx_arg_interp_type);
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __Pyx_CyFunction_Defaults(__pyx_defaults3, __pyx_self)->__pyx_arg_interp_type)) __PYX_ERR(0, 5539, __pyx_L1_error);
__pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 5539, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__Pyx_GIVEREF(__pyx_t_1);
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1)) __PYX_ERR(0, 5539, __pyx_L1_error);
__Pyx_INCREF(Py_None);
__Pyx_GIVEREF(Py_None);
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, Py_None)) __PYX_ERR(0, 5539, __pyx_L1_error);
__pyx_t_1 = 0;
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("pysndlib.clm.__defaults__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_605array_resample(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_8pysndlib_3clm_605array_resample = {"array_resample", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_605array_resample, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_8pysndlib_3clm_605array_resample(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
PyObject *__pyx_v_arr = 0;
PyObject *__pyx_v_new_length = 0;
PyObject *__pyx_v_interp_type = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("array_resample (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_arr,&__pyx_n_s_new_length,&__pyx_n_s_interp_type,0};
PyObject* values[3] = {0,0,0};
__pyx_defaults3 *__pyx_dynamic_args = __Pyx_CyFunction_Defaults(__pyx_defaults3, __pyx_self);
values[2] = __Pyx_Arg_NewRef_FASTCALL(__pyx_dynamic_args->__pyx_arg_interp_type);
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_arr)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 5539, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_new_length)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 5539, __pyx_L3_error)
else {
__Pyx_RaiseArgtupleInvalid("array_resample", 0, 2, 3, 1); __PYX_ERR(0, 5539, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 2:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_interp_type);
if (value) { values[2] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 5539, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "array_resample") < 0)) __PYX_ERR(0, 5539, __pyx_L3_error)
}
} else {
switch (__pyx_nargs) {
case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
break;
default: goto __pyx_L5_argtuple_error;
}
}
__pyx_v_arr = values[0];
__pyx_v_new_length = values[1];
__pyx_v_interp_type = values[2];
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("array_resample", 0, 2, 3, __pyx_nargs); __PYX_ERR(0, 5539, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.array_resample", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_8pysndlib_3clm_604array_resample(__pyx_self, __pyx_v_arr, __pyx_v_new_length, __pyx_v_interp_type);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_604array_resample(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_arr, PyObject *__pyx_v_new_length, PyObject *__pyx_v_interp_type) {
PyObject *__pyx_v_res = NULL;
PyObject *__pyx_v_inp = NULL;
PyObject *__pyx_v_orig_length = NULL;
PyObject *__pyx_v_indices = NULL;
PyObject *__pyx_v_i = NULL;
PyObject *__pyx_r = NULL;
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_6);
__Pyx_AddTraceback("pysndlib.clm.array_resample", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XDECREF(__pyx_v_res);
__Pyx_XDECREF(__pyx_v_inp);
__Pyx_XDECREF(__pyx_v_orig_length);
__Pyx_XDECREF(__pyx_v_indices);
__Pyx_XDECREF(__pyx_v_i);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_tuple__637 = PyTuple_Pack(8, __pyx_n_s_arr, __pyx_n_s_new_length, __pyx_n_s_interp_type, __pyx_n_s_res, __pyx_n_s_inp, __pyx_n_s_orig_length, __pyx_n_s_indices, __pyx_n_s_i); if (unlikely(!__pyx_tuple__637)) __PYX_ERR(0, 5539, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__637);
__Pyx_GIVEREF(__pyx_tuple__637);
/* … */
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_605array_resample, 0, __pyx_n_s_array_resample, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__638)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 5539, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
if (!__Pyx_CyFunction_InitDefaults(__pyx_t_40, sizeof(__pyx_defaults3), 1)) __PYX_ERR(0, 5539, __pyx_L1_error)
__pyx_t_43 = __Pyx_Enum_Interp_to_py(__pyx_e_8pysndlib_3clm_LINEAR); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 5539, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_43);
__Pyx_CyFunction_Defaults(__pyx_defaults3, __pyx_t_40)->__pyx_arg_interp_type = __pyx_t_43;
__Pyx_GIVEREF(__pyx_t_43);
__pyx_t_43 = 0;
__Pyx_CyFunction_SetDefaultsGetter(__pyx_t_40, __pyx_pf_8pysndlib_3clm_635__defaults__);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_array_resample, __pyx_t_40) < 0) __PYX_ERR(0, 5539, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
__pyx_codeobj__638 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 8, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__637, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_array_resample, 5539, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__638)) __PYX_ERR(0, 5539, __pyx_L1_error)
+5540: res = np.zeros(new_length)
__Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 5540, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 5540, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = NULL; __pyx_t_4 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_3))) { __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_2)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_2); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); __pyx_t_4 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_v_new_length}; __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5540, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } __pyx_v_res = __pyx_t_1; __pyx_t_1 = 0;
+5541: inp = np.array(arr)
__Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 5541, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_array); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 5541, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = NULL; __pyx_t_4 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_2))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); __pyx_t_4 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v_arr}; __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5541, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } __pyx_v_inp = __pyx_t_1; __pyx_t_1 = 0;
+5542: orig_length = len(arr)
__pyx_t_5 = PyObject_Length(__pyx_v_arr); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(0, 5542, __pyx_L1_error) __pyx_t_1 = PyInt_FromSsize_t(__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5542, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_orig_length = __pyx_t_1; __pyx_t_1 = 0;
+5543: indices = np.linspace(0, orig_length-1,new_length)
__Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 5543, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_linspace); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 5543, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_PyInt_SubtractObjC(__pyx_v_orig_length, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 5543, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_6 = NULL; __pyx_t_4 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_3))) { __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_6)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_6); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); __pyx_t_4 = 1; } } #endif { PyObject *__pyx_callargs[4] = {__pyx_t_6, __pyx_int_0, __pyx_t_2, __pyx_v_new_length}; __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_4, 3+__pyx_t_4); __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5543, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } __pyx_v_indices = __pyx_t_1; __pyx_t_1 = 0;
+5544: for i in range(new_length):
__pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_range, __pyx_v_new_length); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5544, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) { __pyx_t_3 = __pyx_t_1; __Pyx_INCREF(__pyx_t_3); __pyx_t_5 = 0; __pyx_t_7 = NULL; } else { __pyx_t_5 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 5544, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_7 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 5544, __pyx_L1_error) } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; for (;;) { if (likely(!__pyx_t_7)) { if (likely(PyList_CheckExact(__pyx_t_3))) { { Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_3); #if !CYTHON_ASSUME_SAFE_MACROS if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 5544, __pyx_L1_error) #endif if (__pyx_t_5 >= __pyx_temp) break; } #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS __pyx_t_1 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_5); __Pyx_INCREF(__pyx_t_1); __pyx_t_5++; if (unlikely((0 < 0))) __PYX_ERR(0, 5544, __pyx_L1_error) #else __pyx_t_1 = __Pyx_PySequence_ITEM(__pyx_t_3, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5544, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); #endif } else { { Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_3); #if !CYTHON_ASSUME_SAFE_MACROS if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 5544, __pyx_L1_error) #endif if (__pyx_t_5 >= __pyx_temp) break; } #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_5); __Pyx_INCREF(__pyx_t_1); __pyx_t_5++; if (unlikely((0 < 0))) __PYX_ERR(0, 5544, __pyx_L1_error) #else __pyx_t_1 = __Pyx_PySequence_ITEM(__pyx_t_3, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5544, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); #endif } } else { __pyx_t_1 = __pyx_t_7(__pyx_t_3); if (unlikely(!__pyx_t_1)) { PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); else __PYX_ERR(0, 5544, __pyx_L1_error) } break; } __Pyx_GOTREF(__pyx_t_1); } __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_1); __pyx_t_1 = 0; /* … */ } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+5545: res[i] = mus_interpolate(interp_type, indices[i], inp)
__pyx_t_8 = ((enum __pyx_t_8pysndlib_3clm_Interp)__Pyx_PyInt_As_enum____pyx_t_8pysndlib_3clm_Interp(__pyx_v_interp_type)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 5545, __pyx_L1_error) __pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_v_indices, __pyx_v_i); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5545, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_9 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_9 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 5545, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (!(likely(((__pyx_v_inp) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_inp, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 5545, __pyx_L1_error) __pyx_t_10 = __pyx_f_8pysndlib_3clm_mus_interpolate(__pyx_t_8, __pyx_t_9, ((PyArrayObject *)__pyx_v_inp), 0, NULL); if (unlikely(__pyx_t_10 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 5545, __pyx_L1_error) __pyx_t_1 = PyFloat_FromDouble(__pyx_t_10); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5545, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (unlikely((PyObject_SetItem(__pyx_v_res, __pyx_v_i, __pyx_t_1) < 0))) __PYX_ERR(0, 5545, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+5546: return res
__Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_v_res); __pyx_r = __pyx_v_res; goto __pyx_L0;
5547:
5548:
+5549: def phase_delay(gen, freq):
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_607phase_delay(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_8pysndlib_3clm_607phase_delay = {"phase_delay", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_607phase_delay, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_8pysndlib_3clm_607phase_delay(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
PyObject *__pyx_v_gen = 0;
PyObject *__pyx_v_freq = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("phase_delay (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gen,&__pyx_n_s_freq,0};
PyObject* values[2] = {0,0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_gen)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 5549, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_freq)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 5549, __pyx_L3_error)
else {
__Pyx_RaiseArgtupleInvalid("phase_delay", 1, 2, 2, 1); __PYX_ERR(0, 5549, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "phase_delay") < 0)) __PYX_ERR(0, 5549, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 2)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
}
__pyx_v_gen = values[0];
__pyx_v_freq = values[1];
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("phase_delay", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 5549, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.phase_delay", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_8pysndlib_3clm_606phase_delay(__pyx_self, __pyx_v_gen, __pyx_v_freq);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_606phase_delay(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_gen, PyObject *__pyx_v_freq) {
PyObject *__pyx_v_omega_t = NULL;
PyObject *__pyx_v_real = NULL;
PyObject *__pyx_v_imag = NULL;
PyObject *__pyx_v_i = NULL;
PyObject *__pyx_v_phase = NULL;
PyObject *__pyx_r = NULL;
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_XDECREF(__pyx_t_7);
__Pyx_XDECREF(__pyx_t_8);
__Pyx_XDECREF(__pyx_t_9);
__Pyx_AddTraceback("pysndlib.clm.phase_delay", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XDECREF(__pyx_v_omega_t);
__Pyx_XDECREF(__pyx_v_real);
__Pyx_XDECREF(__pyx_v_imag);
__Pyx_XDECREF(__pyx_v_i);
__Pyx_XDECREF(__pyx_v_phase);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_gb_8pysndlib_3clm_610generator(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */
/* … */
__pyx_tuple__639 = PyTuple_Pack(7, __pyx_n_s_gen, __pyx_n_s_freq, __pyx_n_s_omega_t, __pyx_n_s_real, __pyx_n_s_imag, __pyx_n_s_i, __pyx_n_s_phase); if (unlikely(!__pyx_tuple__639)) __PYX_ERR(0, 5549, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__639);
__Pyx_GIVEREF(__pyx_tuple__639);
/* … */
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_607phase_delay, 0, __pyx_n_s_phase_delay, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__640)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 5549, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_phase_delay, __pyx_t_40) < 0) __PYX_ERR(0, 5549, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
__pyx_codeobj__640 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 7, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__639, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_phase_delay, 5549, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__640)) __PYX_ERR(0, 5549, __pyx_L1_error)
+5550: omega_t = 2 * np.pi * freq / get_srate()
__Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5550, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_pi); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 5550, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_PyInt_MultiplyCObj(__pyx_int_2, __pyx_t_2, 2, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5550, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = PyNumber_Multiply(__pyx_t_1, __pyx_v_freq); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 5550, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_3 = __pyx_f_8pysndlib_3clm_get_srate(0); if (unlikely(__pyx_t_3 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 5550, __pyx_L1_error) __pyx_t_1 = PyFloat_FromDouble(__pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5550, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_4 = __Pyx_PyNumber_Divide(__pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 5550, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_omega_t = __pyx_t_4; __pyx_t_4 = 0;
+5551: real = 0.
__Pyx_INCREF(__pyx_float_0_);
__pyx_v_real = __pyx_float_0_;
+5552: imag = 0.
__Pyx_INCREF(__pyx_float_0_);
__pyx_v_imag = __pyx_float_0_;
+5553: for i in range(len(gen.mus_xcoeffs)):
__pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_gen, __pyx_n_s_mus_xcoeffs); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 5553, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = PyObject_Length(__pyx_t_4); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(0, 5553, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = PyInt_FromSsize_t(__pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 5553, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_range, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5553, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) { __pyx_t_4 = __pyx_t_1; __Pyx_INCREF(__pyx_t_4); __pyx_t_5 = 0; __pyx_t_6 = NULL; } else { __pyx_t_5 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 5553, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_6 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 5553, __pyx_L1_error) } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; for (;;) { if (likely(!__pyx_t_6)) { if (likely(PyList_CheckExact(__pyx_t_4))) { { Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_4); #if !CYTHON_ASSUME_SAFE_MACROS if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 5553, __pyx_L1_error) #endif if (__pyx_t_5 >= __pyx_temp) break; } #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS __pyx_t_1 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_1); __pyx_t_5++; if (unlikely((0 < 0))) __PYX_ERR(0, 5553, __pyx_L1_error) #else __pyx_t_1 = __Pyx_PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5553, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); #endif } else { { Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_4); #if !CYTHON_ASSUME_SAFE_MACROS if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 5553, __pyx_L1_error) #endif if (__pyx_t_5 >= __pyx_temp) break; } #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_1); __pyx_t_5++; if (unlikely((0 < 0))) __PYX_ERR(0, 5553, __pyx_L1_error) #else __pyx_t_1 = __Pyx_PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5553, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); #endif } } else { __pyx_t_1 = __pyx_t_6(__pyx_t_4); if (unlikely(!__pyx_t_1)) { PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); else __PYX_ERR(0, 5553, __pyx_L1_error) } break; } __Pyx_GOTREF(__pyx_t_1); } __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_1); __pyx_t_1 = 0; /* … */ } __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+5554: real += gen.mus_xcoeffs[i] * math.cos(i * omega_t)
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_gen, __pyx_n_s_mus_xcoeffs); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5554, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_v_i); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 5554, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_math); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 5554, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_cos); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 5554, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_7 = PyNumber_Multiply(__pyx_v_i, __pyx_v_omega_t); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 5554, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_9 = NULL; __pyx_t_10 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_8))) { __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_8); if (likely(__pyx_t_9)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8); __Pyx_INCREF(__pyx_t_9); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_8, function); __pyx_t_10 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_9, __pyx_t_7}; __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_8, __pyx_callargs+1-__pyx_t_10, 1+__pyx_t_10); __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5554, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; } __pyx_t_8 = PyNumber_Multiply(__pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 5554, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_v_real, __pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5554, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_DECREF_SET(__pyx_v_real, __pyx_t_1); __pyx_t_1 = 0;
+5555: imag -= gen.mus_xcoeffs[i] * math.sin(i * omega_t)
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_gen, __pyx_n_s_mus_xcoeffs); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5555, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_8 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_v_i); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 5555, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_math); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 5555, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_sin); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 5555, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = PyNumber_Multiply(__pyx_v_i, __pyx_v_omega_t); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 5555, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_9 = NULL; __pyx_t_10 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_7))) { __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_7); if (likely(__pyx_t_9)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7); __Pyx_INCREF(__pyx_t_9); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_7, function); __pyx_t_10 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_9, __pyx_t_2}; __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_7, __pyx_callargs+1-__pyx_t_10, 1+__pyx_t_10); __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5555, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; } __pyx_t_7 = PyNumber_Multiply(__pyx_t_8, __pyx_t_1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 5555, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyNumber_InPlaceSubtract(__pyx_v_imag, __pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5555, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF_SET(__pyx_v_imag, __pyx_t_1); __pyx_t_1 = 0;
5556: # print(gen.mus_xcoeffs[0])
+5557: real *= gen.mus_xcoeffs[0]
__pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_gen, __pyx_n_s_mus_xcoeffs); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 5557, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_4, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5557, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = PyNumber_InPlaceMultiply(__pyx_v_real, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 5557, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF_SET(__pyx_v_real, __pyx_t_4); __pyx_t_4 = 0;
+5558: imag *= gen.mus_xcoeffs[0]
__pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_gen, __pyx_n_s_mus_xcoeffs); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 5558, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_4, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5558, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = PyNumber_InPlaceMultiply(__pyx_v_imag, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 5558, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF_SET(__pyx_v_imag, __pyx_t_4); __pyx_t_4 = 0;
+5559: phase = math.atan2(imag, real)
__Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_math); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5559, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_atan2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 5559, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = NULL; __pyx_t_10 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_7))) { __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_7); if (likely(__pyx_t_1)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7); __Pyx_INCREF(__pyx_t_1); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_7, function); __pyx_t_10 = 1; } } #endif { PyObject *__pyx_callargs[3] = {__pyx_t_1, __pyx_v_imag, __pyx_v_real}; __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_7, __pyx_callargs+1-__pyx_t_10, 2+__pyx_t_10); __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 5559, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; } __pyx_v_phase = __pyx_t_4; __pyx_t_4 = 0;
+5560: real = 0.
__Pyx_INCREF(__pyx_float_0_); __Pyx_DECREF_SET(__pyx_v_real, __pyx_float_0_);
+5561: imag = 0.
__Pyx_INCREF(__pyx_float_0_); __Pyx_DECREF_SET(__pyx_v_imag, __pyx_float_0_);
+5562: for i in range(len(gen.mus_ycoeffs)):
__pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_gen, __pyx_n_s_mus_ycoeffs); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 5562, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = PyObject_Length(__pyx_t_4); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(0, 5562, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = PyInt_FromSsize_t(__pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 5562, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_builtin_range, __pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 5562, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (likely(PyList_CheckExact(__pyx_t_7)) || PyTuple_CheckExact(__pyx_t_7)) { __pyx_t_4 = __pyx_t_7; __Pyx_INCREF(__pyx_t_4); __pyx_t_5 = 0; __pyx_t_6 = NULL; } else { __pyx_t_5 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 5562, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_6 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 5562, __pyx_L1_error) } __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; for (;;) { if (likely(!__pyx_t_6)) { if (likely(PyList_CheckExact(__pyx_t_4))) { { Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_4); #if !CYTHON_ASSUME_SAFE_MACROS if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 5562, __pyx_L1_error) #endif if (__pyx_t_5 >= __pyx_temp) break; } #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS __pyx_t_7 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++; if (unlikely((0 < 0))) __PYX_ERR(0, 5562, __pyx_L1_error) #else __pyx_t_7 = __Pyx_PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 5562, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); #endif } else { { Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_4); #if !CYTHON_ASSUME_SAFE_MACROS if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 5562, __pyx_L1_error) #endif if (__pyx_t_5 >= __pyx_temp) break; } #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++; if (unlikely((0 < 0))) __PYX_ERR(0, 5562, __pyx_L1_error) #else __pyx_t_7 = __Pyx_PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 5562, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); #endif } } else { __pyx_t_7 = __pyx_t_6(__pyx_t_4); if (unlikely(!__pyx_t_7)) { PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); else __PYX_ERR(0, 5562, __pyx_L1_error) } break; } __Pyx_GOTREF(__pyx_t_7); } __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_7); __pyx_t_7 = 0; /* … */ } __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+5563: real += gen.mus_ycoeffs[i] * math.cos(i * omega_t)
__pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_gen, __pyx_n_s_mus_ycoeffs); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 5563, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_t_7, __pyx_v_i); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5563, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_math); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 5563, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_cos); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 5563, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __pyx_t_8 = PyNumber_Multiply(__pyx_v_i, __pyx_v_omega_t); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 5563, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __pyx_t_9 = NULL; __pyx_t_10 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_2))) { __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_9)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_9); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); __pyx_t_10 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_9, __pyx_t_8}; __pyx_t_7 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_10, 1+__pyx_t_10); __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 5563, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } __pyx_t_2 = PyNumber_Multiply(__pyx_t_1, __pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 5563, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_7 = PyNumber_InPlaceAdd(__pyx_v_real, __pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 5563, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF_SET(__pyx_v_real, __pyx_t_7); __pyx_t_7 = 0;
+5564: imag -= gen.mus_ycoeffs[i] * math.sin(i * omega_t)
__pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_gen, __pyx_n_s_mus_ycoeffs); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 5564, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_t_7, __pyx_v_i); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 5564, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_math); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5564, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_sin); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 5564, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyNumber_Multiply(__pyx_v_i, __pyx_v_omega_t); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5564, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_9 = NULL; __pyx_t_10 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_8))) { __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_8); if (likely(__pyx_t_9)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8); __Pyx_INCREF(__pyx_t_9); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_8, function); __pyx_t_10 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_9, __pyx_t_1}; __pyx_t_7 = __Pyx_PyObject_FastCall(__pyx_t_8, __pyx_callargs+1-__pyx_t_10, 1+__pyx_t_10); __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 5564, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; } __pyx_t_8 = PyNumber_Multiply(__pyx_t_2, __pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 5564, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_7 = PyNumber_InPlaceSubtract(__pyx_v_imag, __pyx_t_8); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 5564, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_DECREF_SET(__pyx_v_imag, __pyx_t_7); __pyx_t_7 = 0;
+5565: phase -= math.atan2(imag, real)
__Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_math); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 5565, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_atan2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 5565, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_7 = NULL; __pyx_t_10 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_8))) { __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_8); if (likely(__pyx_t_7)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8); __Pyx_INCREF(__pyx_t_7); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_8, function); __pyx_t_10 = 1; } } #endif { PyObject *__pyx_callargs[3] = {__pyx_t_7, __pyx_v_imag, __pyx_v_real}; __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_8, __pyx_callargs+1-__pyx_t_10, 2+__pyx_t_10); __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 5565, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; } __pyx_t_8 = PyNumber_InPlaceSubtract(__pyx_v_phase, __pyx_t_4); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 5565, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF_SET(__pyx_v_phase, __pyx_t_8); __pyx_t_8 = 0;
+5566: phase = math.fmod(-phase, 2 * np.pi)
__Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_math); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 5566, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_fmod); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 5566, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = PyNumber_Negative(__pyx_v_phase); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 5566, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 5566, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_pi); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5566, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_PyInt_MultiplyCObj(__pyx_int_2, __pyx_t_1, 2, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 5566, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = NULL; __pyx_t_10 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_7))) { __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_7); if (likely(__pyx_t_1)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7); __Pyx_INCREF(__pyx_t_1); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_7, function); __pyx_t_10 = 1; } } #endif { PyObject *__pyx_callargs[3] = {__pyx_t_1, __pyx_t_4, __pyx_t_2}; __pyx_t_8 = __Pyx_PyObject_FastCall(__pyx_t_7, __pyx_callargs+1-__pyx_t_10, 2+__pyx_t_10); __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 5566, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; } __Pyx_DECREF_SET(__pyx_v_phase, __pyx_t_8); __pyx_t_8 = 0;
+5567: return phase / omega_t
__Pyx_XDECREF(__pyx_r); __pyx_t_8 = __Pyx_PyNumber_Divide(__pyx_v_phase, __pyx_v_omega_t); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 5567, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __pyx_r = __pyx_t_8; __pyx_t_8 = 0; goto __pyx_L0;
5568:
5569:
5570:
+5571: def impulse_generator(arr):
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_609impulse_generator(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_8pysndlib_3clm_609impulse_generator = {"impulse_generator", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_609impulse_generator, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_8pysndlib_3clm_609impulse_generator(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
PyObject *__pyx_v_arr = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("impulse_generator (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_arr,0};
PyObject* values[1] = {0};
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_arr)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 5571, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "impulse_generator") < 0)) __PYX_ERR(0, 5571, __pyx_L3_error)
}
} else if (unlikely(__pyx_nargs != 1)) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
}
__pyx_v_arr = values[0];
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("impulse_generator", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 5571, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.impulse_generator", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_8pysndlib_3clm_608impulse_generator(__pyx_self, __pyx_v_arr);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* function exit code */
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_608impulse_generator(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_arr) {
struct __pyx_obj_8pysndlib_3clm___pyx_scope_struct_8_impulse_generator *__pyx_cur_scope;
PyObject *__pyx_r = NULL;
__pyx_cur_scope = (struct __pyx_obj_8pysndlib_3clm___pyx_scope_struct_8_impulse_generator *)__pyx_tp_new_8pysndlib_3clm___pyx_scope_struct_8_impulse_generator(__pyx_ptype_8pysndlib_3clm___pyx_scope_struct_8_impulse_generator, __pyx_empty_tuple, NULL);
if (unlikely(!__pyx_cur_scope)) {
__pyx_cur_scope = ((struct __pyx_obj_8pysndlib_3clm___pyx_scope_struct_8_impulse_generator *)Py_None);
__Pyx_INCREF(Py_None);
__PYX_ERR(0, 5571, __pyx_L1_error)
} else {
__Pyx_GOTREF((PyObject *)__pyx_cur_scope);
}
__pyx_cur_scope->__pyx_v_arr = __pyx_v_arr;
__Pyx_INCREF(__pyx_cur_scope->__pyx_v_arr);
__Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_arr);
{
__pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_8pysndlib_3clm_610generator, __pyx_codeobj__76, (PyObject *) __pyx_cur_scope, __pyx_n_s_impulse_generator, __pyx_n_s_impulse_generator, __pyx_n_s_pysndlib_clm); if (unlikely(!gen)) __PYX_ERR(0, 5571, __pyx_L1_error)
__Pyx_DECREF(__pyx_cur_scope);
__Pyx_RefNannyFinishContext();
return (PyObject *) gen;
}
/* function exit code */
__pyx_L1_error:;
__Pyx_AddTraceback("pysndlib.clm.impulse_generator", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__Pyx_DECREF((PyObject *)__pyx_cur_scope);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_gb_8pysndlib_3clm_610generator(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("impulse_generator", 0);
__pyx_L3_first_run:;
if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 5571, __pyx_L1_error)
/* … */
/* function exit code */
PyErr_SetNone(PyExc_StopIteration);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_Generator_Replace_StopIteration(0);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_AddTraceback("impulse_generator", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_L0:;
__Pyx_XDECREF(__pyx_r); __pyx_r = 0;
#if !CYTHON_USE_EXC_INFO_STACK
__Pyx_Coroutine_ResetAndClearException(__pyx_generator);
#endif
__pyx_generator->resume_label = -1;
__Pyx_Coroutine_clear((PyObject*)__pyx_generator);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_tuple__641 = PyTuple_Pack(3, __pyx_n_s_arr, __pyx_n_s_n, __pyx_n_s_num); if (unlikely(!__pyx_tuple__641)) __PYX_ERR(0, 5571, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__641);
__Pyx_GIVEREF(__pyx_tuple__641);
/* … */
__pyx_t_40 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_609impulse_generator, 0, __pyx_n_s_impulse_generator, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__76)); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 5571, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_40);
if (PyDict_SetItem(__pyx_d, __pyx_n_s_impulse_generator, __pyx_t_40) < 0) __PYX_ERR(0, 5571, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
__pyx_codeobj__76 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__641, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_impulse_generator, 5571, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__76)) __PYX_ERR(0, 5571, __pyx_L1_error)
/* … */
struct __pyx_obj_8pysndlib_3clm___pyx_scope_struct_8_impulse_generator {
PyObject_HEAD
PyObject *__pyx_v_arr;
PyObject *__pyx_v_n;
Py_ssize_t __pyx_v_num;
};
+5572: n = 0
__Pyx_INCREF(__pyx_int_0); __Pyx_GIVEREF(__pyx_int_0); __pyx_cur_scope->__pyx_v_n = __pyx_int_0;
+5573: num = len(arr)
__pyx_t_1 = PyObject_Length(__pyx_cur_scope->__pyx_v_arr); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 5573, __pyx_L1_error) __pyx_cur_scope->__pyx_v_num = __pyx_t_1;
+5574: while n < num:
while (1) {
__pyx_t_2 = PyInt_FromSsize_t(__pyx_cur_scope->__pyx_v_num); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 5574, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_3 = PyObject_RichCompare(__pyx_cur_scope->__pyx_v_n, __pyx_t_2, Py_LT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 5574, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 5574, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
if (!__pyx_t_4) break;
+5575: yield arr[n]
__pyx_t_3 = __Pyx_PyObject_GetItem(__pyx_cur_scope->__pyx_v_arr, __pyx_cur_scope->__pyx_v_n); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 5575, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_r = __pyx_t_3; __pyx_t_3 = 0; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); __Pyx_Coroutine_ResetAndClearException(__pyx_generator); /* return from generator, yielding value */ __pyx_generator->resume_label = 1; return __pyx_r; __pyx_L6_resume_from_yield:; if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 5575, __pyx_L1_error)
+5576: n += 1
__pyx_t_3 = __Pyx_PyInt_AddObjC(__pyx_cur_scope->__pyx_v_n, __pyx_int_1, 1, 1, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 5576, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_n); __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_n, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = 0; } CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);
5577:
5578: #not sure typing any of the args are worth it.
+5579: @cython.ccall
static PyObject *__pyx_pw_8pysndlib_3clm_612fm_violin(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyObject *__pyx_f_8pysndlib_3clm_fm_violin(PyObject *__pyx_v_beg, PyObject *__pyx_v_dur, PyObject *__pyx_v_frequency, PyObject *__pyx_v_amplitude, PyObject *__pyx_v_fm_index, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_8pysndlib_3clm_fm_violin *__pyx_optional_args) {
PyObject *__pyx_v_amp_env = __pyx_k__77;
PyObject *__pyx_v_periodic_vibrato_rate = ((PyObject *)__pyx_float_5_0);
PyObject *__pyx_v_random_vibrato_rate = ((PyObject *)__pyx_float_16_0);
PyObject *__pyx_v_periodic_vibrato_amplitude = ((PyObject *)__pyx_float_0_0025);
PyObject *__pyx_v_random_vibrato_amplitude = ((PyObject *)__pyx_float_0_005);
/* … */
/* function exit code */
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_5);
__Pyx_XDECREF(__pyx_t_7);
__Pyx_XDECREF(__pyx_t_8);
__Pyx_AddTraceback("pysndlib.clm.fm_violin", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XDECREF((PyObject *)__pyx_v_carrier);
__Pyx_XDECREF((PyObject *)__pyx_v_fmosc1);
__Pyx_XDECREF((PyObject *)__pyx_v_fmosc2);
__Pyx_XDECREF((PyObject *)__pyx_v_fmosc3);
__Pyx_XDECREF((PyObject *)__pyx_v_ampf);
__Pyx_XDECREF((PyObject *)__pyx_v_indf1);
__Pyx_XDECREF((PyObject *)__pyx_v_indf2);
__Pyx_XDECREF((PyObject *)__pyx_v_indf3);
__Pyx_XDECREF((PyObject *)__pyx_v_frqf);
__Pyx_XDECREF((PyObject *)__pyx_v_pervib);
__Pyx_XDECREF((PyObject *)__pyx_v_ranvib);
__Pyx_XDECREF((PyObject *)__pyx_v_fm_noi);
__Pyx_XDECREF((PyObject *)__pyx_v_ind_noi);
__Pyx_XDECREF((PyObject *)__pyx_v_amp_noi);
__Pyx_XDECREF((PyObject *)__pyx_v_loc);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_8pysndlib_3clm_612fm_violin(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
static PyMethodDef __pyx_mdef_8pysndlib_3clm_612fm_violin = {"fm_violin", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pysndlib_3clm_612fm_violin, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_8pysndlib_3clm_612fm_violin(PyObject *__pyx_self,
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
PyObject *__pyx_v_beg = 0;
PyObject *__pyx_v_dur = 0;
PyObject *__pyx_v_frequency = 0;
PyObject *__pyx_v_amplitude = 0;
PyObject *__pyx_v_fm_index = 0;
PyObject *__pyx_v_amp_env = 0;
PyObject *__pyx_v_periodic_vibrato_rate = 0;
PyObject *__pyx_v_random_vibrato_rate = 0;
PyObject *__pyx_v_periodic_vibrato_amplitude = 0;
PyObject *__pyx_v_random_vibrato_amplitude = 0;
PyObject *__pyx_v_fm1_index = 0;
PyObject *__pyx_v_fm2_index = 0;
PyObject *__pyx_v_fm3_index = 0;
PyObject *__pyx_v_fm1_rat = 0;
PyObject *__pyx_v_fm2_rat = 0;
PyObject *__pyx_v_fm3_rat = 0;
PyObject *__pyx_v_fm1_env = 0;
PyObject *__pyx_v_fm2_env = 0;
PyObject *__pyx_v_fm3_env = 0;
PyObject *__pyx_v_gliss_env = 0;
PyObject *__pyx_v_glissando_amount = 0;
PyObject *__pyx_v_noise_amount = 0;
PyObject *__pyx_v_noise_freq = 0;
PyObject *__pyx_v_ind_noise_freq = 0;
PyObject *__pyx_v_ind_noise_amount = 0;
PyObject *__pyx_v_amp_noise_freq = 0;
PyObject *__pyx_v_amp_noise_amount = 0;
PyObject *__pyx_v_degree = 0;
PyObject *__pyx_v_distance = 0;
PyObject *__pyx_v_reverb_amount = 0;
#if !CYTHON_METH_FASTCALL
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
#endif
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("fm_violin (wrapper)", 0);
#if !CYTHON_METH_FASTCALL
#if CYTHON_ASSUME_SAFE_MACROS
__pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
#else
__pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
#endif
#endif
__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
{
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_beg,&__pyx_n_s_dur,&__pyx_n_s_frequency,&__pyx_n_s_amplitude,&__pyx_n_s_fm_index,&__pyx_n_s_amp_env,&__pyx_n_s_periodic_vibrato_rate,&__pyx_n_s_random_vibrato_rate,&__pyx_n_s_periodic_vibrato_amplitude,&__pyx_n_s_random_vibrato_amplitude,&__pyx_n_s_fm1_index,&__pyx_n_s_fm2_index,&__pyx_n_s_fm3_index,&__pyx_n_s_fm1_rat,&__pyx_n_s_fm2_rat,&__pyx_n_s_fm3_rat,&__pyx_n_s_fm1_env,&__pyx_n_s_fm2_env,&__pyx_n_s_fm3_env,&__pyx_n_s_gliss_env,&__pyx_n_s_glissando_amount,&__pyx_n_s_noise_amount,&__pyx_n_s_noise_freq,&__pyx_n_s_ind_noise_freq,&__pyx_n_s_ind_noise_amount,&__pyx_n_s_amp_noise_freq,&__pyx_n_s_amp_noise_amount,&__pyx_n_s_degree,&__pyx_n_s_distance,&__pyx_n_s_reverb_amount,0};
PyObject* values[30] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
values[5] = __Pyx_Arg_NewRef_FASTCALL(__pyx_k__77);
values[6] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)__pyx_float_5_0));
values[7] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)__pyx_float_16_0));
values[8] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)__pyx_float_0_0025));
values[9] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)__pyx_float_0_005));
/* … */
/* function exit code */
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_8pysndlib_3clm_611fm_violin(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_beg, PyObject *__pyx_v_dur, PyObject *__pyx_v_frequency, PyObject *__pyx_v_amplitude, PyObject *__pyx_v_fm_index, PyObject *__pyx_v_amp_env, PyObject *__pyx_v_periodic_vibrato_rate, PyObject *__pyx_v_random_vibrato_rate, PyObject *__pyx_v_periodic_vibrato_amplitude, PyObject *__pyx_v_random_vibrato_amplitude, PyObject *__pyx_v_fm1_index, PyObject *__pyx_v_fm2_index, PyObject *__pyx_v_fm3_index, PyObject *__pyx_v_fm1_rat, PyObject *__pyx_v_fm2_rat, PyObject *__pyx_v_fm3_rat, PyObject *__pyx_v_fm1_env, PyObject *__pyx_v_fm2_env, PyObject *__pyx_v_fm3_env, PyObject *__pyx_v_gliss_env, PyObject *__pyx_v_glissando_amount, PyObject *__pyx_v_noise_amount, PyObject *__pyx_v_noise_freq, PyObject *__pyx_v_ind_noise_freq, PyObject *__pyx_v_ind_noise_amount, PyObject *__pyx_v_amp_noise_freq, PyObject *__pyx_v_amp_noise_amount, PyObject *__pyx_v_degree, PyObject *__pyx_v_distance, PyObject *__pyx_v_reverb_amount) {
PyObject *__pyx_r = NULL;
__Pyx_XDECREF(__pyx_r);
__pyx_t_2.__pyx_n = 25;
__pyx_t_2.amp_env = __pyx_v_amp_env;
__pyx_t_2.periodic_vibrato_rate = __pyx_v_periodic_vibrato_rate;
__pyx_t_2.random_vibrato_rate = __pyx_v_random_vibrato_rate;
__pyx_t_2.periodic_vibrato_amplitude = __pyx_v_periodic_vibrato_amplitude;
__pyx_t_2.random_vibrato_amplitude = __pyx_v_random_vibrato_amplitude;
__pyx_t_2.fm1_index = __pyx_v_fm1_index;
__pyx_t_2.fm2_index = __pyx_v_fm2_index;
__pyx_t_2.fm3_index = __pyx_v_fm3_index;
__pyx_t_2.fm1_rat = __pyx_v_fm1_rat;
__pyx_t_2.fm2_rat = __pyx_v_fm2_rat;
__pyx_t_2.fm3_rat = __pyx_v_fm3_rat;
__pyx_t_2.fm1_env = __pyx_v_fm1_env;
__pyx_t_2.fm2_env = __pyx_v_fm2_env;
__pyx_t_2.fm3_env = __pyx_v_fm3_env;
__pyx_t_2.gliss_env = __pyx_v_gliss_env;
__pyx_t_2.glissando_amount = __pyx_v_glissando_amount;
__pyx_t_2.noise_amount = __pyx_v_noise_amount;
__pyx_t_2.noise_freq = __pyx_v_noise_freq;
__pyx_t_2.ind_noise_freq = __pyx_v_ind_noise_freq;
__pyx_t_2.ind_noise_amount = __pyx_v_ind_noise_amount;
__pyx_t_2.amp_noise_freq = __pyx_v_amp_noise_freq;
__pyx_t_2.amp_noise_amount = __pyx_v_amp_noise_amount;
__pyx_t_2.degree = __pyx_v_degree;
__pyx_t_2.distance = __pyx_v_distance;
__pyx_t_2.reverb_amount = __pyx_v_reverb_amount;
__pyx_t_1 = __pyx_f_8pysndlib_3clm_fm_violin(__pyx_v_beg, __pyx_v_dur, __pyx_v_frequency, __pyx_v_amplitude, __pyx_v_fm_index, 0, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5579, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("pysndlib.clm.fm_violin", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* … */
__pyx_tuple__642 = PyTuple_Pack(30, __pyx_n_s_beg, __pyx_n_s_dur, __pyx_n_s_frequency, __pyx_n_s_amplitude, __pyx_n_s_fm_index, __pyx_n_s_amp_env, __pyx_n_s_periodic_vibrato_rate, __pyx_n_s_random_vibrato_rate, __pyx_n_s_periodic_vibrato_amplitude, __pyx_n_s_random_vibrato_amplitude, __pyx_n_s_fm1_index, __pyx_n_s_fm2_index, __pyx_n_s_fm3_index, __pyx_n_s_fm1_rat, __pyx_n_s_fm2_rat, __pyx_n_s_fm3_rat, __pyx_n_s_fm1_env, __pyx_n_s_fm2_env, __pyx_n_s_fm3_env, __pyx_n_s_gliss_env, __pyx_n_s_glissando_amount, __pyx_n_s_noise_amount, __pyx_n_s_noise_freq, __pyx_n_s_ind_noise_freq, __pyx_n_s_ind_noise_amount, __pyx_n_s_amp_noise_freq, __pyx_n_s_amp_noise_amount, __pyx_n_s_degree, __pyx_n_s_distance, __pyx_n_s_reverb_amount); if (unlikely(!__pyx_tuple__642)) __PYX_ERR(0, 5579, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__642);
__Pyx_GIVEREF(__pyx_tuple__642);
/* … */
__pyx_t_10 = PyTuple_New(25); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 5579, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_10);
__Pyx_GIVEREF(__pyx_t_40);
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_40)) __PYX_ERR(0, 5579, __pyx_L1_error);
__Pyx_INCREF(__pyx_float_5_0);
__Pyx_GIVEREF(__pyx_float_5_0);
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_float_5_0)) __PYX_ERR(0, 5579, __pyx_L1_error);
__Pyx_INCREF(__pyx_float_16_0);
__Pyx_GIVEREF(__pyx_float_16_0);
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_10, 2, __pyx_float_16_0)) __PYX_ERR(0, 5579, __pyx_L1_error);
__Pyx_INCREF(__pyx_float_0_0025);
__Pyx_GIVEREF(__pyx_float_0_0025);
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_10, 3, __pyx_float_0_0025)) __PYX_ERR(0, 5579, __pyx_L1_error);
__Pyx_INCREF(__pyx_float_0_005);
__Pyx_GIVEREF(__pyx_float_0_005);
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_10, 4, __pyx_float_0_005)) __PYX_ERR(0, 5579, __pyx_L1_error);
__Pyx_INCREF(Py_None);
__Pyx_GIVEREF(Py_None);
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_10, 5, Py_None)) __PYX_ERR(0, 5579, __pyx_L1_error);
__Pyx_INCREF(Py_None);
__Pyx_GIVEREF(Py_None);
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_10, 6, Py_None)) __PYX_ERR(0, 5579, __pyx_L1_error);
__Pyx_INCREF(Py_None);
__Pyx_GIVEREF(Py_None);
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_10, 7, Py_None)) __PYX_ERR(0, 5579, __pyx_L1_error);
__Pyx_INCREF(__pyx_float_1_0);
__Pyx_GIVEREF(__pyx_float_1_0);
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_10, 8, __pyx_float_1_0)) __PYX_ERR(0, 5579, __pyx_L1_error);
__Pyx_INCREF(__pyx_float_3_0);
__Pyx_GIVEREF(__pyx_float_3_0);
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_10, 9, __pyx_float_3_0)) __PYX_ERR(0, 5579, __pyx_L1_error);
__Pyx_INCREF(__pyx_float_4_0);
__Pyx_GIVEREF(__pyx_float_4_0);
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_10, 10, __pyx_float_4_0)) __PYX_ERR(0, 5579, __pyx_L1_error);
__Pyx_GIVEREF(__pyx_t_43);
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_10, 11, __pyx_t_43)) __PYX_ERR(0, 5579, __pyx_L1_error);
__Pyx_GIVEREF(__pyx_t_37);
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_10, 12, __pyx_t_37)) __PYX_ERR(0, 5579, __pyx_L1_error);
__Pyx_GIVEREF(__pyx_t_41);
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_10, 13, __pyx_t_41)) __PYX_ERR(0, 5579, __pyx_L1_error);
__Pyx_GIVEREF(__pyx_t_42);
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_10, 14, __pyx_t_42)) __PYX_ERR(0, 5579, __pyx_L1_error);
__Pyx_INCREF(__pyx_float_0_0);
__Pyx_GIVEREF(__pyx_float_0_0);
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_10, 15, __pyx_float_0_0)) __PYX_ERR(0, 5579, __pyx_L1_error);
__Pyx_INCREF(__pyx_float_0_0);
__Pyx_GIVEREF(__pyx_float_0_0);
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_10, 16, __pyx_float_0_0)) __PYX_ERR(0, 5579, __pyx_L1_error);
__Pyx_INCREF(__pyx_float_1000_);
__Pyx_GIVEREF(__pyx_float_1000_);
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_10, 17, __pyx_float_1000_)) __PYX_ERR(0, 5579, __pyx_L1_error);
__Pyx_INCREF(__pyx_float_10_);
__Pyx_GIVEREF(__pyx_float_10_);
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_10, 18, __pyx_float_10_)) __PYX_ERR(0, 5579, __pyx_L1_error);
__Pyx_INCREF(__pyx_float_0_0);
__Pyx_GIVEREF(__pyx_float_0_0);
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_10, 19, __pyx_float_0_0)) __PYX_ERR(0, 5579, __pyx_L1_error);
__Pyx_INCREF(__pyx_float_20_0);
__Pyx_GIVEREF(__pyx_float_20_0);
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_10, 20, __pyx_float_20_0)) __PYX_ERR(0, 5579, __pyx_L1_error);
__Pyx_INCREF(__pyx_float_0_0);
__Pyx_GIVEREF(__pyx_float_0_0);
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_10, 21, __pyx_float_0_0)) __PYX_ERR(0, 5579, __pyx_L1_error);
__Pyx_INCREF(__pyx_int_45);
__Pyx_GIVEREF(__pyx_int_45);
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_10, 22, __pyx_int_45)) __PYX_ERR(0, 5579, __pyx_L1_error);
__Pyx_INCREF(__pyx_float_1_0);
__Pyx_GIVEREF(__pyx_float_1_0);
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_10, 23, __pyx_float_1_0)) __PYX_ERR(0, 5579, __pyx_L1_error);
__Pyx_INCREF(__pyx_float__01);
__Pyx_GIVEREF(__pyx_float__01);
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_10, 24, __pyx_float__01)) __PYX_ERR(0, 5579, __pyx_L1_error);
__pyx_t_40 = 0;
__pyx_t_43 = 0;
__pyx_t_37 = 0;
__pyx_t_41 = 0;
__pyx_t_42 = 0;
__pyx_t_42 = __Pyx_CyFunction_New(&__pyx_mdef_8pysndlib_3clm_612fm_violin, 0, __pyx_n_s_fm_violin, NULL, __pyx_n_s_pysndlib_clm, __pyx_d, ((PyObject *)__pyx_codeobj__643)); if (unlikely(!__pyx_t_42)) __PYX_ERR(0, 5579, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_42);
__Pyx_CyFunction_SetDefaultsTuple(__pyx_t_42, __pyx_t_10);
__Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
if (PyDict_SetItem(__pyx_d, __pyx_n_s_fm_violin, __pyx_t_42) < 0) __PYX_ERR(0, 5579, __pyx_L1_error)
__Pyx_DECREF(__pyx_t_42); __pyx_t_42 = 0;
__pyx_codeobj__643 = (PyObject*)__Pyx_PyCode_New(30, 0, 0, 30, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__642, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pysndlib_clm_pyx, __pyx_n_s_fm_violin, 5579, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__643)) __PYX_ERR(0, 5579, __pyx_L1_error)
/* … */
struct __pyx_opt_args_8pysndlib_3clm_fm_violin {
int __pyx_n;
PyObject *amp_env;
PyObject *periodic_vibrato_rate;
PyObject *random_vibrato_rate;
PyObject *periodic_vibrato_amplitude;
PyObject *random_vibrato_amplitude;
PyObject *fm1_index;
PyObject *fm2_index;
PyObject *fm3_index;
PyObject *fm1_rat;
PyObject *fm2_rat;
PyObject *fm3_rat;
PyObject *fm1_env;
PyObject *fm2_env;
PyObject *fm3_env;
PyObject *gliss_env;
PyObject *glissando_amount;
PyObject *noise_amount;
PyObject *noise_freq;
PyObject *ind_noise_freq;
PyObject *ind_noise_amount;
PyObject *amp_noise_freq;
PyObject *amp_noise_amount;
PyObject *degree;
PyObject *distance;
PyObject *reverb_amount;
};
5580: def fm_violin(beg, dur, frequency, amplitude, fm_index,
+5581: amp_env = [ 0, 0, 25, 1, 75, 1, 100, 0],
__pyx_t_40 = PyList_New(8); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 5581, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_40); __Pyx_INCREF(__pyx_int_0); __Pyx_GIVEREF(__pyx_int_0); if (__Pyx_PyList_SET_ITEM(__pyx_t_40, 0, __pyx_int_0)) __PYX_ERR(0, 5581, __pyx_L1_error); __Pyx_INCREF(__pyx_int_0); __Pyx_GIVEREF(__pyx_int_0); if (__Pyx_PyList_SET_ITEM(__pyx_t_40, 1, __pyx_int_0)) __PYX_ERR(0, 5581, __pyx_L1_error); __Pyx_INCREF(__pyx_int_25); __Pyx_GIVEREF(__pyx_int_25); if (__Pyx_PyList_SET_ITEM(__pyx_t_40, 2, __pyx_int_25)) __PYX_ERR(0, 5581, __pyx_L1_error); __Pyx_INCREF(__pyx_int_1); __Pyx_GIVEREF(__pyx_int_1); if (__Pyx_PyList_SET_ITEM(__pyx_t_40, 3, __pyx_int_1)) __PYX_ERR(0, 5581, __pyx_L1_error); __Pyx_INCREF(__pyx_int_75); __Pyx_GIVEREF(__pyx_int_75); if (__Pyx_PyList_SET_ITEM(__pyx_t_40, 4, __pyx_int_75)) __PYX_ERR(0, 5581, __pyx_L1_error); __Pyx_INCREF(__pyx_int_1); __Pyx_GIVEREF(__pyx_int_1); if (__Pyx_PyList_SET_ITEM(__pyx_t_40, 5, __pyx_int_1)) __PYX_ERR(0, 5581, __pyx_L1_error); __Pyx_INCREF(__pyx_int_100); __Pyx_GIVEREF(__pyx_int_100); if (__Pyx_PyList_SET_ITEM(__pyx_t_40, 6, __pyx_int_100)) __PYX_ERR(0, 5581, __pyx_L1_error); __Pyx_INCREF(__pyx_int_0); __Pyx_GIVEREF(__pyx_int_0); if (__Pyx_PyList_SET_ITEM(__pyx_t_40, 7, __pyx_int_0)) __PYX_ERR(0, 5581, __pyx_L1_error); __pyx_k__77 = __pyx_t_40; __Pyx_GIVEREF(__pyx_t_40); __pyx_t_40 = 0; /* … */ __pyx_t_40 = PyList_New(8); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 5581, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_40); __Pyx_INCREF(__pyx_int_0); __Pyx_GIVEREF(__pyx_int_0); if (__Pyx_PyList_SET_ITEM(__pyx_t_40, 0, __pyx_int_0)) __PYX_ERR(0, 5581, __pyx_L1_error); __Pyx_INCREF(__pyx_int_0); __Pyx_GIVEREF(__pyx_int_0); if (__Pyx_PyList_SET_ITEM(__pyx_t_40, 1, __pyx_int_0)) __PYX_ERR(0, 5581, __pyx_L1_error); __Pyx_INCREF(__pyx_int_25); __Pyx_GIVEREF(__pyx_int_25); if (__Pyx_PyList_SET_ITEM(__pyx_t_40, 2, __pyx_int_25)) __PYX_ERR(0, 5581, __pyx_L1_error); __Pyx_INCREF(__pyx_int_1); __Pyx_GIVEREF(__pyx_int_1); if (__Pyx_PyList_SET_ITEM(__pyx_t_40, 3, __pyx_int_1)) __PYX_ERR(0, 5581, __pyx_L1_error); __Pyx_INCREF(__pyx_int_75); __Pyx_GIVEREF(__pyx_int_75); if (__Pyx_PyList_SET_ITEM(__pyx_t_40, 4, __pyx_int_75)) __PYX_ERR(0, 5581, __pyx_L1_error); __Pyx_INCREF(__pyx_int_1); __Pyx_GIVEREF(__pyx_int_1); if (__Pyx_PyList_SET_ITEM(__pyx_t_40, 5, __pyx_int_1)) __PYX_ERR(0, 5581, __pyx_L1_error); __Pyx_INCREF(__pyx_int_100); __Pyx_GIVEREF(__pyx_int_100); if (__Pyx_PyList_SET_ITEM(__pyx_t_40, 6, __pyx_int_100)) __PYX_ERR(0, 5581, __pyx_L1_error); __Pyx_INCREF(__pyx_int_0); __Pyx_GIVEREF(__pyx_int_0); if (__Pyx_PyList_SET_ITEM(__pyx_t_40, 7, __pyx_int_0)) __PYX_ERR(0, 5581, __pyx_L1_error);
5582: periodic_vibrato_rate = 5.0,
5583: random_vibrato_rate = 16.0,
5584: periodic_vibrato_amplitude = 0.0025,
5585: random_vibrato_amplitude = 0.005,
+5586: fm1_index=None,
PyObject *__pyx_v_fm1_index = ((PyObject *)Py_None);
/* … */
values[10] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
+5587: fm2_index=None,
PyObject *__pyx_v_fm2_index = ((PyObject *)Py_None);
/* … */
values[11] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
+5588: fm3_index=None,
PyObject *__pyx_v_fm3_index = ((PyObject *)Py_None);
PyObject *__pyx_v_fm1_rat = ((PyObject *)__pyx_float_1_0);
PyObject *__pyx_v_fm2_rat = ((PyObject *)__pyx_float_3_0);
PyObject *__pyx_v_fm3_rat = ((PyObject *)__pyx_float_4_0);
PyObject *__pyx_v_fm1_env = __pyx_k__78;
PyObject *__pyx_v_fm2_env = __pyx_k__79;
PyObject *__pyx_v_fm3_env = __pyx_k__80;
PyObject *__pyx_v_gliss_env = __pyx_k__81;
PyObject *__pyx_v_glissando_amount = ((PyObject *)__pyx_float_0_0);
PyObject *__pyx_v_noise_amount = ((PyObject *)__pyx_float_0_0);
PyObject *__pyx_v_noise_freq = ((PyObject *)__pyx_float_1000_);
PyObject *__pyx_v_ind_noise_freq = ((PyObject *)__pyx_float_10_);
PyObject *__pyx_v_ind_noise_amount = ((PyObject *)__pyx_float_0_0);
PyObject *__pyx_v_amp_noise_freq = ((PyObject *)__pyx_float_20_0);
PyObject *__pyx_v_amp_noise_amount = ((PyObject *)__pyx_float_0_0);
PyObject *__pyx_v_degree = ((PyObject *)__pyx_int_45);
PyObject *__pyx_v_distance = ((PyObject *)__pyx_float_1_0);
PyObject *__pyx_v_reverb_amount = ((PyObject *)__pyx_float__01);
int __pyx_v_start;
int __pyx_v_end;
double __pyx_v_frq_scl;
double __pyx_v_maxdev;
double __pyx_v_index1;
double __pyx_v_index2;
double __pyx_v_index3;
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_carrier = 0;
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_fmosc1 = 0;
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_fmosc2 = 0;
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_fmosc3 = 0;
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_ampf = 0;
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_indf1 = 0;
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_indf2 = 0;
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_indf3 = 0;
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_frqf = 0;
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_pervib = 0;
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_ranvib = 0;
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_fm_noi = 0;
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_ind_noi = 0;
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_amp_noi = 0;
struct __pyx_obj_8pysndlib_3clm_mus_any *__pyx_v_loc = 0;
int __pyx_v_i;
double __pyx_v_vib;
double __pyx_v_fuzz;
double __pyx_v_inoi;
double __pyx_v_anoi;
PyObject *__pyx_r = NULL;
if (__pyx_optional_args) {
if (__pyx_optional_args->__pyx_n > 0) {
__pyx_v_amp_env = __pyx_optional_args->amp_env;
if (__pyx_optional_args->__pyx_n > 1) {
__pyx_v_periodic_vibrato_rate = __pyx_optional_args->periodic_vibrato_rate;
if (__pyx_optional_args->__pyx_n > 2) {
__pyx_v_random_vibrato_rate = __pyx_optional_args->random_vibrato_rate;
if (__pyx_optional_args->__pyx_n > 3) {
__pyx_v_periodic_vibrato_amplitude = __pyx_optional_args->periodic_vibrato_amplitude;
if (__pyx_optional_args->__pyx_n > 4) {
__pyx_v_random_vibrato_amplitude = __pyx_optional_args->random_vibrato_amplitude;
if (__pyx_optional_args->__pyx_n > 5) {
__pyx_v_fm1_index = __pyx_optional_args->fm1_index;
if (__pyx_optional_args->__pyx_n > 6) {
__pyx_v_fm2_index = __pyx_optional_args->fm2_index;
if (__pyx_optional_args->__pyx_n > 7) {
__pyx_v_fm3_index = __pyx_optional_args->fm3_index;
if (__pyx_optional_args->__pyx_n > 8) {
__pyx_v_fm1_rat = __pyx_optional_args->fm1_rat;
if (__pyx_optional_args->__pyx_n > 9) {
__pyx_v_fm2_rat = __pyx_optional_args->fm2_rat;
if (__pyx_optional_args->__pyx_n > 10) {
__pyx_v_fm3_rat = __pyx_optional_args->fm3_rat;
if (__pyx_optional_args->__pyx_n > 11) {
__pyx_v_fm1_env = __pyx_optional_args->fm1_env;
if (__pyx_optional_args->__pyx_n > 12) {
__pyx_v_fm2_env = __pyx_optional_args->fm2_env;
if (__pyx_optional_args->__pyx_n > 13) {
__pyx_v_fm3_env = __pyx_optional_args->fm3_env;
if (__pyx_optional_args->__pyx_n > 14) {
__pyx_v_gliss_env = __pyx_optional_args->gliss_env;
if (__pyx_optional_args->__pyx_n > 15) {
__pyx_v_glissando_amount = __pyx_optional_args->glissando_amount;
if (__pyx_optional_args->__pyx_n > 16) {
__pyx_v_noise_amount = __pyx_optional_args->noise_amount;
if (__pyx_optional_args->__pyx_n > 17) {
__pyx_v_noise_freq = __pyx_optional_args->noise_freq;
if (__pyx_optional_args->__pyx_n > 18) {
__pyx_v_ind_noise_freq = __pyx_optional_args->ind_noise_freq;
if (__pyx_optional_args->__pyx_n > 19) {
__pyx_v_ind_noise_amount = __pyx_optional_args->ind_noise_amount;
if (__pyx_optional_args->__pyx_n > 20) {
__pyx_v_amp_noise_freq = __pyx_optional_args->amp_noise_freq;
if (__pyx_optional_args->__pyx_n > 21) {
__pyx_v_amp_noise_amount = __pyx_optional_args->amp_noise_amount;
if (__pyx_optional_args->__pyx_n > 22) {
__pyx_v_degree = __pyx_optional_args->degree;
if (__pyx_optional_args->__pyx_n > 23) {
__pyx_v_distance = __pyx_optional_args->distance;
if (__pyx_optional_args->__pyx_n > 24) {
__pyx_v_reverb_amount = __pyx_optional_args->reverb_amount;
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
/* … */
values[12] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
values[13] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)__pyx_float_1_0));
values[14] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)__pyx_float_3_0));
values[15] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)__pyx_float_4_0));
values[16] = __Pyx_Arg_NewRef_FASTCALL(__pyx_k__78);
values[17] = __Pyx_Arg_NewRef_FASTCALL(__pyx_k__79);
values[18] = __Pyx_Arg_NewRef_FASTCALL(__pyx_k__80);
values[19] = __Pyx_Arg_NewRef_FASTCALL(__pyx_k__81);
values[20] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)__pyx_float_0_0));
values[21] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)__pyx_float_0_0));
values[22] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)__pyx_float_1000_));
values[23] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)__pyx_float_10_));
values[24] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)__pyx_float_0_0));
values[25] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)__pyx_float_20_0));
values[26] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)__pyx_float_0_0));
values[27] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)__pyx_int_45));
values[28] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)__pyx_float_1_0));
values[29] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)__pyx_float__01));
if (__pyx_kwds) {
Py_ssize_t kw_args;
switch (__pyx_nargs) {
case 30: values[29] = __Pyx_Arg_FASTCALL(__pyx_args, 29);
CYTHON_FALLTHROUGH;
case 29: values[28] = __Pyx_Arg_FASTCALL(__pyx_args, 28);
CYTHON_FALLTHROUGH;
case 28: values[27] = __Pyx_Arg_FASTCALL(__pyx_args, 27);
CYTHON_FALLTHROUGH;
case 27: values[26] = __Pyx_Arg_FASTCALL(__pyx_args, 26);
CYTHON_FALLTHROUGH;
case 26: values[25] = __Pyx_Arg_FASTCALL(__pyx_args, 25);
CYTHON_FALLTHROUGH;
case 25: values[24] = __Pyx_Arg_FASTCALL(__pyx_args, 24);
CYTHON_FALLTHROUGH;
case 24: values[23] = __Pyx_Arg_FASTCALL(__pyx_args, 23);
CYTHON_FALLTHROUGH;
case 23: values[22] = __Pyx_Arg_FASTCALL(__pyx_args, 22);
CYTHON_FALLTHROUGH;
case 22: values[21] = __Pyx_Arg_FASTCALL(__pyx_args, 21);
CYTHON_FALLTHROUGH;
case 21: values[20] = __Pyx_Arg_FASTCALL(__pyx_args, 20);
CYTHON_FALLTHROUGH;
case 20: values[19] = __Pyx_Arg_FASTCALL(__pyx_args, 19);
CYTHON_FALLTHROUGH;
case 19: values[18] = __Pyx_Arg_FASTCALL(__pyx_args, 18);
CYTHON_FALLTHROUGH;
case 18: values[17] = __Pyx_Arg_FASTCALL(__pyx_args, 17);
CYTHON_FALLTHROUGH;
case 17: values[16] = __Pyx_Arg_FASTCALL(__pyx_args, 16);
CYTHON_FALLTHROUGH;
case 16: values[15] = __Pyx_Arg_FASTCALL(__pyx_args, 15);
CYTHON_FALLTHROUGH;
case 15: values[14] = __Pyx_Arg_FASTCALL(__pyx_args, 14);
CYTHON_FALLTHROUGH;
case 14: values[13] = __Pyx_Arg_FASTCALL(__pyx_args, 13);
CYTHON_FALLTHROUGH;
case 13: values[12] = __Pyx_Arg_FASTCALL(__pyx_args, 12);
CYTHON_FALLTHROUGH;
case 12: values[11] = __Pyx_Arg_FASTCALL(__pyx_args, 11);
CYTHON_FALLTHROUGH;
case 11: values[10] = __Pyx_Arg_FASTCALL(__pyx_args, 10);
CYTHON_FALLTHROUGH;
case 10: values[9] = __Pyx_Arg_FASTCALL(__pyx_args, 9);
CYTHON_FALLTHROUGH;
case 9: values[8] = __Pyx_Arg_FASTCALL(__pyx_args, 8);
CYTHON_FALLTHROUGH;
case 8: values[7] = __Pyx_Arg_FASTCALL(__pyx_args, 7);
CYTHON_FALLTHROUGH;
case 7: values[6] = __Pyx_Arg_FASTCALL(__pyx_args, 6);
CYTHON_FALLTHROUGH;
case 6: values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5);
CYTHON_FALLTHROUGH;
case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4);
CYTHON_FALLTHROUGH;
case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
CYTHON_FALLTHROUGH;
case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
CYTHON_FALLTHROUGH;
case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
CYTHON_FALLTHROUGH;
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
CYTHON_FALLTHROUGH;
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
switch (__pyx_nargs) {
case 0:
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_beg)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 5579, __pyx_L3_error)
else goto __pyx_L5_argtuple_error;
CYTHON_FALLTHROUGH;
case 1:
if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_dur)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 5579, __pyx_L3_error)
else {
__Pyx_RaiseArgtupleInvalid("fm_violin", 0, 5, 30, 1); __PYX_ERR(0, 5579, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 2:
if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_frequency)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[2]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 5579, __pyx_L3_error)
else {
__Pyx_RaiseArgtupleInvalid("fm_violin", 0, 5, 30, 2); __PYX_ERR(0, 5579, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 3:
if (likely((values[3] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_amplitude)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[3]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 5579, __pyx_L3_error)
else {
__Pyx_RaiseArgtupleInvalid("fm_violin", 0, 5, 30, 3); __PYX_ERR(0, 5579, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 4:
if (likely((values[4] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_fm_index)) != 0)) {
(void)__Pyx_Arg_NewRef_FASTCALL(values[4]);
kw_args--;
}
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 5579, __pyx_L3_error)
else {
__Pyx_RaiseArgtupleInvalid("fm_violin", 0, 5, 30, 4); __PYX_ERR(0, 5579, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 5:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_amp_env);
if (value) { values[5] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 5579, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 6:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_periodic_vibrato_rate);
if (value) { values[6] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 5579, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 7:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_random_vibrato_rate);
if (value) { values[7] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 5579, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 8:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_periodic_vibrato_amplitude);
if (value) { values[8] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 5579, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 9:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_random_vibrato_amplitude);
if (value) { values[9] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 5579, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 10:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_fm1_index);
if (value) { values[10] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 5579, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 11:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_fm2_index);
if (value) { values[11] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 5579, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 12:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_fm3_index);
if (value) { values[12] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 5579, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 13:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_fm1_rat);
if (value) { values[13] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 5579, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 14:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_fm2_rat);
if (value) { values[14] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 5579, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 15:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_fm3_rat);
if (value) { values[15] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 5579, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 16:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_fm1_env);
if (value) { values[16] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 5579, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 17:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_fm2_env);
if (value) { values[17] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 5579, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 18:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_fm3_env);
if (value) { values[18] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 5579, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 19:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_gliss_env);
if (value) { values[19] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 5579, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 20:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_glissando_amount);
if (value) { values[20] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 5579, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 21:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_noise_amount);
if (value) { values[21] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 5579, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 22:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_noise_freq);
if (value) { values[22] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 5579, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 23:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_ind_noise_freq);
if (value) { values[23] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 5579, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 24:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_ind_noise_amount);
if (value) { values[24] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 5579, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 25:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_amp_noise_freq);
if (value) { values[25] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 5579, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 26:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_amp_noise_amount);
if (value) { values[26] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 5579, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 27:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_degree);
if (value) { values[27] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 5579, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 28:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_distance);
if (value) { values[28] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 5579, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 29:
if (kw_args > 0) {
PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_reverb_amount);
if (value) { values[29] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 5579, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
const Py_ssize_t kwd_pos_args = __pyx_nargs;
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "fm_violin") < 0)) __PYX_ERR(0, 5579, __pyx_L3_error)
}
} else {
switch (__pyx_nargs) {
case 30: values[29] = __Pyx_Arg_FASTCALL(__pyx_args, 29);
CYTHON_FALLTHROUGH;
case 29: values[28] = __Pyx_Arg_FASTCALL(__pyx_args, 28);
CYTHON_FALLTHROUGH;
case 28: values[27] = __Pyx_Arg_FASTCALL(__pyx_args, 27);
CYTHON_FALLTHROUGH;
case 27: values[26] = __Pyx_Arg_FASTCALL(__pyx_args, 26);
CYTHON_FALLTHROUGH;
case 26: values[25] = __Pyx_Arg_FASTCALL(__pyx_args, 25);
CYTHON_FALLTHROUGH;
case 25: values[24] = __Pyx_Arg_FASTCALL(__pyx_args, 24);
CYTHON_FALLTHROUGH;
case 24: values[23] = __Pyx_Arg_FASTCALL(__pyx_args, 23);
CYTHON_FALLTHROUGH;
case 23: values[22] = __Pyx_Arg_FASTCALL(__pyx_args, 22);
CYTHON_FALLTHROUGH;
case 22: values[21] = __Pyx_Arg_FASTCALL(__pyx_args, 21);
CYTHON_FALLTHROUGH;
case 21: values[20] = __Pyx_Arg_FASTCALL(__pyx_args, 20);
CYTHON_FALLTHROUGH;
case 20: values[19] = __Pyx_Arg_FASTCALL(__pyx_args, 19);
CYTHON_FALLTHROUGH;
case 19: values[18] = __Pyx_Arg_FASTCALL(__pyx_args, 18);
CYTHON_FALLTHROUGH;
case 18: values[17] = __Pyx_Arg_FASTCALL(__pyx_args, 17);
CYTHON_FALLTHROUGH;
case 17: values[16] = __Pyx_Arg_FASTCALL(__pyx_args, 16);
CYTHON_FALLTHROUGH;
case 16: values[15] = __Pyx_Arg_FASTCALL(__pyx_args, 15);
CYTHON_FALLTHROUGH;
case 15: values[14] = __Pyx_Arg_FASTCALL(__pyx_args, 14);
CYTHON_FALLTHROUGH;
case 14: values[13] = __Pyx_Arg_FASTCALL(__pyx_args, 13);
CYTHON_FALLTHROUGH;
case 13: values[12] = __Pyx_Arg_FASTCALL(__pyx_args, 12);
CYTHON_FALLTHROUGH;
case 12: values[11] = __Pyx_Arg_FASTCALL(__pyx_args, 11);
CYTHON_FALLTHROUGH;
case 11: values[10] = __Pyx_Arg_FASTCALL(__pyx_args, 10);
CYTHON_FALLTHROUGH;
case 10: values[9] = __Pyx_Arg_FASTCALL(__pyx_args, 9);
CYTHON_FALLTHROUGH;
case 9: values[8] = __Pyx_Arg_FASTCALL(__pyx_args, 8);
CYTHON_FALLTHROUGH;
case 8: values[7] = __Pyx_Arg_FASTCALL(__pyx_args, 7);
CYTHON_FALLTHROUGH;
case 7: values[6] = __Pyx_Arg_FASTCALL(__pyx_args, 6);
CYTHON_FALLTHROUGH;
case 6: values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5);
CYTHON_FALLTHROUGH;
case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4);
values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
break;
default: goto __pyx_L5_argtuple_error;
}
}
__pyx_v_beg = values[0];
__pyx_v_dur = values[1];
__pyx_v_frequency = values[2];
__pyx_v_amplitude = values[3];
__pyx_v_fm_index = values[4];
__pyx_v_amp_env = values[5];
__pyx_v_periodic_vibrato_rate = values[6];
__pyx_v_random_vibrato_rate = values[7];
__pyx_v_periodic_vibrato_amplitude = values[8];
__pyx_v_random_vibrato_amplitude = values[9];
__pyx_v_fm1_index = values[10];
__pyx_v_fm2_index = values[11];
__pyx_v_fm3_index = values[12];
__pyx_v_fm1_rat = values[13];
__pyx_v_fm2_rat = values[14];
__pyx_v_fm3_rat = values[15];
__pyx_v_fm1_env = values[16];
__pyx_v_fm2_env = values[17];
__pyx_v_fm3_env = values[18];
__pyx_v_gliss_env = values[19];
__pyx_v_glissando_amount = values[20];
__pyx_v_noise_amount = values[21];
__pyx_v_noise_freq = values[22];
__pyx_v_ind_noise_freq = values[23];
__pyx_v_ind_noise_amount = values[24];
__pyx_v_amp_noise_freq = values[25];
__pyx_v_amp_noise_amount = values[26];
__pyx_v_degree = values[27];
__pyx_v_distance = values[28];
__pyx_v_reverb_amount = values[29];
}
goto __pyx_L6_skip;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("fm_violin", 0, 5, 30, __pyx_nargs); __PYX_ERR(0, 5579, __pyx_L3_error)
__pyx_L6_skip:;
goto __pyx_L4_argument_unpacking_done;
__pyx_L3_error:;
{
Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
__Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
}
}
__Pyx_AddTraceback("pysndlib.clm.fm_violin", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_8pysndlib_3clm_611fm_violin(__pyx_self, __pyx_v_beg, __pyx_v_dur, __pyx_v_frequency, __pyx_v_amplitude, __pyx_v_fm_index, __pyx_v_amp_env, __pyx_v_periodic_vibrato_rate, __pyx_v_random_vibrato_rate, __pyx_v_periodic_vibrato_amplitude, __pyx_v_random_vibrato_amplitude, __pyx_v_fm1_index, __pyx_v_fm2_index, __pyx_v_fm3_index, __pyx_v_fm1_rat, __pyx_v_fm2_rat, __pyx_v_fm3_rat, __pyx_v_fm1_env, __pyx_v_fm2_env, __pyx_v_fm3_env, __pyx_v_gliss_env, __pyx_v_glissando_amount, __pyx_v_noise_amount, __pyx_v_noise_freq, __pyx_v_ind_noise_freq, __pyx_v_ind_noise_amount, __pyx_v_amp_noise_freq, __pyx_v_amp_noise_amount, __pyx_v_degree, __pyx_v_distance, __pyx_v_reverb_amount);
5589: fm1_rat = 1.0,
5590: fm2_rat = 3.0,
5591: fm3_rat = 4.0,
+5592: fm1_env = [0., 1., 25., .4, 75., .6, 100., 0.],
__pyx_t_40 = PyList_New(8); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 5592, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_40); __Pyx_INCREF(__pyx_float_0_); __Pyx_GIVEREF(__pyx_float_0_); if (__Pyx_PyList_SET_ITEM(__pyx_t_40, 0, __pyx_float_0_)) __PYX_ERR(0, 5592, __pyx_L1_error); __Pyx_INCREF(__pyx_float_1_); __Pyx_GIVEREF(__pyx_float_1_); if (__Pyx_PyList_SET_ITEM(__pyx_t_40, 1, __pyx_float_1_)) __PYX_ERR(0, 5592, __pyx_L1_error); __Pyx_INCREF(__pyx_float_25_); __Pyx_GIVEREF(__pyx_float_25_); if (__Pyx_PyList_SET_ITEM(__pyx_t_40, 2, __pyx_float_25_)) __PYX_ERR(0, 5592, __pyx_L1_error); __Pyx_INCREF(__pyx_float__4); __Pyx_GIVEREF(__pyx_float__4); if (__Pyx_PyList_SET_ITEM(__pyx_t_40, 3, __pyx_float__4)) __PYX_ERR(0, 5592, __pyx_L1_error); __Pyx_INCREF(__pyx_float_75_); __Pyx_GIVEREF(__pyx_float_75_); if (__Pyx_PyList_SET_ITEM(__pyx_t_40, 4, __pyx_float_75_)) __PYX_ERR(0, 5592, __pyx_L1_error); __Pyx_INCREF(__pyx_float__6); __Pyx_GIVEREF(__pyx_float__6); if (__Pyx_PyList_SET_ITEM(__pyx_t_40, 5, __pyx_float__6)) __PYX_ERR(0, 5592, __pyx_L1_error); __Pyx_INCREF(__pyx_float_100_); __Pyx_GIVEREF(__pyx_float_100_); if (__Pyx_PyList_SET_ITEM(__pyx_t_40, 6, __pyx_float_100_)) __PYX_ERR(0, 5592, __pyx_L1_error); __Pyx_INCREF(__pyx_float_0_); __Pyx_GIVEREF(__pyx_float_0_); if (__Pyx_PyList_SET_ITEM(__pyx_t_40, 7, __pyx_float_0_)) __PYX_ERR(0, 5592, __pyx_L1_error); __pyx_k__78 = __pyx_t_40; __Pyx_GIVEREF(__pyx_t_40); __pyx_t_40 = 0; /* … */ __pyx_t_43 = PyList_New(8); if (unlikely(!__pyx_t_43)) __PYX_ERR(0, 5592, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_43); __Pyx_INCREF(__pyx_float_0_); __Pyx_GIVEREF(__pyx_float_0_); if (__Pyx_PyList_SET_ITEM(__pyx_t_43, 0, __pyx_float_0_)) __PYX_ERR(0, 5592, __pyx_L1_error); __Pyx_INCREF(__pyx_float_1_); __Pyx_GIVEREF(__pyx_float_1_); if (__Pyx_PyList_SET_ITEM(__pyx_t_43, 1, __pyx_float_1_)) __PYX_ERR(0, 5592, __pyx_L1_error); __Pyx_INCREF(__pyx_float_25_); __Pyx_GIVEREF(__pyx_float_25_); if (__Pyx_PyList_SET_ITEM(__pyx_t_43, 2, __pyx_float_25_)) __PYX_ERR(0, 5592, __pyx_L1_error); __Pyx_INCREF(__pyx_float__4); __Pyx_GIVEREF(__pyx_float__4); if (__Pyx_PyList_SET_ITEM(__pyx_t_43, 3, __pyx_float__4)) __PYX_ERR(0, 5592, __pyx_L1_error); __Pyx_INCREF(__pyx_float_75_); __Pyx_GIVEREF(__pyx_float_75_); if (__Pyx_PyList_SET_ITEM(__pyx_t_43, 4, __pyx_float_75_)) __PYX_ERR(0, 5592, __pyx_L1_error); __Pyx_INCREF(__pyx_float__6); __Pyx_GIVEREF(__pyx_float__6); if (__Pyx_PyList_SET_ITEM(__pyx_t_43, 5, __pyx_float__6)) __PYX_ERR(0, 5592, __pyx_L1_error); __Pyx_INCREF(__pyx_float_100_); __Pyx_GIVEREF(__pyx_float_100_); if (__Pyx_PyList_SET_ITEM(__pyx_t_43, 6, __pyx_float_100_)) __PYX_ERR(0, 5592, __pyx_L1_error); __Pyx_INCREF(__pyx_float_0_); __Pyx_GIVEREF(__pyx_float_0_); if (__Pyx_PyList_SET_ITEM(__pyx_t_43, 7, __pyx_float_0_)) __PYX_ERR(0, 5592, __pyx_L1_error);
+5593: fm2_env = [0., 1., 25., .4, 75., .6, 100., 0.],
__pyx_t_40 = PyList_New(8); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 5593, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_40); __Pyx_INCREF(__pyx_float_0_); __Pyx_GIVEREF(__pyx_float_0_); if (__Pyx_PyList_SET_ITEM(__pyx_t_40, 0, __pyx_float_0_)) __PYX_ERR(0, 5593, __pyx_L1_error); __Pyx_INCREF(__pyx_float_1_); __Pyx_GIVEREF(__pyx_float_1_); if (__Pyx_PyList_SET_ITEM(__pyx_t_40, 1, __pyx_float_1_)) __PYX_ERR(0, 5593, __pyx_L1_error); __Pyx_INCREF(__pyx_float_25_); __Pyx_GIVEREF(__pyx_float_25_); if (__Pyx_PyList_SET_ITEM(__pyx_t_40, 2, __pyx_float_25_)) __PYX_ERR(0, 5593, __pyx_L1_error); __Pyx_INCREF(__pyx_float__4); __Pyx_GIVEREF(__pyx_float__4); if (__Pyx_PyList_SET_ITEM(__pyx_t_40, 3, __pyx_float__4)) __PYX_ERR(0, 5593, __pyx_L1_error); __Pyx_INCREF(__pyx_float_75_); __Pyx_GIVEREF(__pyx_float_75_); if (__Pyx_PyList_SET_ITEM(__pyx_t_40, 4, __pyx_float_75_)) __PYX_ERR(0, 5593, __pyx_L1_error); __Pyx_INCREF(__pyx_float__6); __Pyx_GIVEREF(__pyx_float__6); if (__Pyx_PyList_SET_ITEM(__pyx_t_40, 5, __pyx_float__6)) __PYX_ERR(0, 5593, __pyx_L1_error); __Pyx_INCREF(__pyx_float_100_); __Pyx_GIVEREF(__pyx_float_100_); if (__Pyx_PyList_SET_ITEM(__pyx_t_40, 6, __pyx_float_100_)) __PYX_ERR(0, 5593, __pyx_L1_error); __Pyx_INCREF(__pyx_float_0_); __Pyx_GIVEREF(__pyx_float_0_); if (__Pyx_PyList_SET_ITEM(__pyx_t_40, 7, __pyx_float_0_)) __PYX_ERR(0, 5593, __pyx_L1_error); __pyx_k__79 = __pyx_t_40; __Pyx_GIVEREF(__pyx_t_40); __pyx_t_40 = 0; /* … */ __pyx_t_37 = PyList_New(8); if (unlikely(!__pyx_t_37)) __PYX_ERR(0, 5593, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_37); __Pyx_INCREF(__pyx_float_0_); __Pyx_GIVEREF(__pyx_float_0_); if (__Pyx_PyList_SET_ITEM(__pyx_t_37, 0, __pyx_float_0_)) __PYX_ERR(0, 5593, __pyx_L1_error); __Pyx_INCREF(__pyx_float_1_); __Pyx_GIVEREF(__pyx_float_1_); if (__Pyx_PyList_SET_ITEM(__pyx_t_37, 1, __pyx_float_1_)) __PYX_ERR(0, 5593, __pyx_L1_error); __Pyx_INCREF(__pyx_float_25_); __Pyx_GIVEREF(__pyx_float_25_); if (__Pyx_PyList_SET_ITEM(__pyx_t_37, 2, __pyx_float_25_)) __PYX_ERR(0, 5593, __pyx_L1_error); __Pyx_INCREF(__pyx_float__4); __Pyx_GIVEREF(__pyx_float__4); if (__Pyx_PyList_SET_ITEM(__pyx_t_37, 3, __pyx_float__4)) __PYX_ERR(0, 5593, __pyx_L1_error); __Pyx_INCREF(__pyx_float_75_); __Pyx_GIVEREF(__pyx_float_75_); if (__Pyx_PyList_SET_ITEM(__pyx_t_37, 4, __pyx_float_75_)) __PYX_ERR(0, 5593, __pyx_L1_error); __Pyx_INCREF(__pyx_float__6); __Pyx_GIVEREF(__pyx_float__6); if (__Pyx_PyList_SET_ITEM(__pyx_t_37, 5, __pyx_float__6)) __PYX_ERR(0, 5593, __pyx_L1_error); __Pyx_INCREF(__pyx_float_100_); __Pyx_GIVEREF(__pyx_float_100_); if (__Pyx_PyList_SET_ITEM(__pyx_t_37, 6, __pyx_float_100_)) __PYX_ERR(0, 5593, __pyx_L1_error); __Pyx_INCREF(__pyx_float_0_); __Pyx_GIVEREF(__pyx_float_0_); if (__Pyx_PyList_SET_ITEM(__pyx_t_37, 7, __pyx_float_0_)) __PYX_ERR(0, 5593, __pyx_L1_error);
+5594: fm3_env = [0., 1., 25., .4, 75., .6, 100., 0.],
__pyx_t_40 = PyList_New(8); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 5594, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_40); __Pyx_INCREF(__pyx_float_0_); __Pyx_GIVEREF(__pyx_float_0_); if (__Pyx_PyList_SET_ITEM(__pyx_t_40, 0, __pyx_float_0_)) __PYX_ERR(0, 5594, __pyx_L1_error); __Pyx_INCREF(__pyx_float_1_); __Pyx_GIVEREF(__pyx_float_1_); if (__Pyx_PyList_SET_ITEM(__pyx_t_40, 1, __pyx_float_1_)) __PYX_ERR(0, 5594, __pyx_L1_error); __Pyx_INCREF(__pyx_float_25_); __Pyx_GIVEREF(__pyx_float_25_); if (__Pyx_PyList_SET_ITEM(__pyx_t_40, 2, __pyx_float_25_)) __PYX_ERR(0, 5594, __pyx_L1_error); __Pyx_INCREF(__pyx_float__4); __Pyx_GIVEREF(__pyx_float__4); if (__Pyx_PyList_SET_ITEM(__pyx_t_40, 3, __pyx_float__4)) __PYX_ERR(0, 5594, __pyx_L1_error); __Pyx_INCREF(__pyx_float_75_); __Pyx_GIVEREF(__pyx_float_75_); if (__Pyx_PyList_SET_ITEM(__pyx_t_40, 4, __pyx_float_75_)) __PYX_ERR(0, 5594, __pyx_L1_error); __Pyx_INCREF(__pyx_float__6); __Pyx_GIVEREF(__pyx_float__6); if (__Pyx_PyList_SET_ITEM(__pyx_t_40, 5, __pyx_float__6)) __PYX_ERR(0, 5594, __pyx_L1_error); __Pyx_INCREF(__pyx_float_100_); __Pyx_GIVEREF(__pyx_float_100_); if (__Pyx_PyList_SET_ITEM(__pyx_t_40, 6, __pyx_float_100_)) __PYX_ERR(0, 5594, __pyx_L1_error); __Pyx_INCREF(__pyx_float_0_); __Pyx_GIVEREF(__pyx_float_0_); if (__Pyx_PyList_SET_ITEM(__pyx_t_40, 7, __pyx_float_0_)) __PYX_ERR(0, 5594, __pyx_L1_error); __pyx_k__80 = __pyx_t_40; __Pyx_GIVEREF(__pyx_t_40); __pyx_t_40 = 0; /* … */ __pyx_t_41 = PyList_New(8); if (unlikely(!__pyx_t_41)) __PYX_ERR(0, 5594, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_41); __Pyx_INCREF(__pyx_float_0_); __Pyx_GIVEREF(__pyx_float_0_); if (__Pyx_PyList_SET_ITEM(__pyx_t_41, 0, __pyx_float_0_)) __PYX_ERR(0, 5594, __pyx_L1_error); __Pyx_INCREF(__pyx_float_1_); __Pyx_GIVEREF(__pyx_float_1_); if (__Pyx_PyList_SET_ITEM(__pyx_t_41, 1, __pyx_float_1_)) __PYX_ERR(0, 5594, __pyx_L1_error); __Pyx_INCREF(__pyx_float_25_); __Pyx_GIVEREF(__pyx_float_25_); if (__Pyx_PyList_SET_ITEM(__pyx_t_41, 2, __pyx_float_25_)) __PYX_ERR(0, 5594, __pyx_L1_error); __Pyx_INCREF(__pyx_float__4); __Pyx_GIVEREF(__pyx_float__4); if (__Pyx_PyList_SET_ITEM(__pyx_t_41, 3, __pyx_float__4)) __PYX_ERR(0, 5594, __pyx_L1_error); __Pyx_INCREF(__pyx_float_75_); __Pyx_GIVEREF(__pyx_float_75_); if (__Pyx_PyList_SET_ITEM(__pyx_t_41, 4, __pyx_float_75_)) __PYX_ERR(0, 5594, __pyx_L1_error); __Pyx_INCREF(__pyx_float__6); __Pyx_GIVEREF(__pyx_float__6); if (__Pyx_PyList_SET_ITEM(__pyx_t_41, 5, __pyx_float__6)) __PYX_ERR(0, 5594, __pyx_L1_error); __Pyx_INCREF(__pyx_float_100_); __Pyx_GIVEREF(__pyx_float_100_); if (__Pyx_PyList_SET_ITEM(__pyx_t_41, 6, __pyx_float_100_)) __PYX_ERR(0, 5594, __pyx_L1_error); __Pyx_INCREF(__pyx_float_0_); __Pyx_GIVEREF(__pyx_float_0_); if (__Pyx_PyList_SET_ITEM(__pyx_t_41, 7, __pyx_float_0_)) __PYX_ERR(0, 5594, __pyx_L1_error);
+5595: gliss_env = [0,0,100,0],
__pyx_t_40 = PyList_New(4); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 5595, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_40); __Pyx_INCREF(__pyx_int_0); __Pyx_GIVEREF(__pyx_int_0); if (__Pyx_PyList_SET_ITEM(__pyx_t_40, 0, __pyx_int_0)) __PYX_ERR(0, 5595, __pyx_L1_error); __Pyx_INCREF(__pyx_int_0); __Pyx_GIVEREF(__pyx_int_0); if (__Pyx_PyList_SET_ITEM(__pyx_t_40, 1, __pyx_int_0)) __PYX_ERR(0, 5595, __pyx_L1_error); __Pyx_INCREF(__pyx_int_100); __Pyx_GIVEREF(__pyx_int_100); if (__Pyx_PyList_SET_ITEM(__pyx_t_40, 2, __pyx_int_100)) __PYX_ERR(0, 5595, __pyx_L1_error); __Pyx_INCREF(__pyx_int_0); __Pyx_GIVEREF(__pyx_int_0); if (__Pyx_PyList_SET_ITEM(__pyx_t_40, 3, __pyx_int_0)) __PYX_ERR(0, 5595, __pyx_L1_error); __pyx_k__81 = __pyx_t_40; __Pyx_GIVEREF(__pyx_t_40); __pyx_t_40 = 0; /* … */ __pyx_t_42 = PyList_New(4); if (unlikely(!__pyx_t_42)) __PYX_ERR(0, 5595, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_42); __Pyx_INCREF(__pyx_int_0); __Pyx_GIVEREF(__pyx_int_0); if (__Pyx_PyList_SET_ITEM(__pyx_t_42, 0, __pyx_int_0)) __PYX_ERR(0, 5595, __pyx_L1_error); __Pyx_INCREF(__pyx_int_0); __Pyx_GIVEREF(__pyx_int_0); if (__Pyx_PyList_SET_ITEM(__pyx_t_42, 1, __pyx_int_0)) __PYX_ERR(0, 5595, __pyx_L1_error); __Pyx_INCREF(__pyx_int_100); __Pyx_GIVEREF(__pyx_int_100); if (__Pyx_PyList_SET_ITEM(__pyx_t_42, 2, __pyx_int_100)) __PYX_ERR(0, 5595, __pyx_L1_error); __Pyx_INCREF(__pyx_int_0); __Pyx_GIVEREF(__pyx_int_0); if (__Pyx_PyList_SET_ITEM(__pyx_t_42, 3, __pyx_int_0)) __PYX_ERR(0, 5595, __pyx_L1_error);
5596: glissando_amount = 0.0,
5597: noise_amount = 0.0,
5598: noise_freq = 1000.,
5599: ind_noise_freq = 10.,
5600: ind_noise_amount = 0.0,
5601: amp_noise_freq = 20.0,
5602: amp_noise_amount = 0.0,
5603: degree=45,
5604: distance=1.0,
5605: reverb_amount = .01):
5606:
5607: if cython.compiled:
+5608: print("Yep, I'm compiled.")
__pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_print, __pyx_tuple__82, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5608, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* … */ __pyx_tuple__82 = PyTuple_Pack(1, __pyx_kp_s_Yep_I_m_compiled); if (unlikely(!__pyx_tuple__82)) __PYX_ERR(0, 5608, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__82); __Pyx_GIVEREF(__pyx_tuple__82);
5609: else:
5610: print("Just a lowly interpreted script.")
5611:
+5612: start: cython.int = seconds2samples(beg)
__pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_v_beg); if (unlikely((__pyx_t_2 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 5612, __pyx_L1_error) __pyx_t_3 = __pyx_f_8pysndlib_3clm_seconds2samples(__pyx_t_2, 0); if (unlikely(__pyx_t_3 == ((long)-1) && PyErr_Occurred())) __PYX_ERR(0, 5612, __pyx_L1_error) __pyx_v_start = __pyx_t_3;
+5613: end: cython.int = start + seconds2samples(dur)
__pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_v_dur); if (unlikely((__pyx_t_2 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 5613, __pyx_L1_error) __pyx_t_3 = __pyx_f_8pysndlib_3clm_seconds2samples(__pyx_t_2, 0); if (unlikely(__pyx_t_3 == ((long)-1) && PyErr_Occurred())) __PYX_ERR(0, 5613, __pyx_L1_error) __pyx_v_end = (__pyx_v_start + __pyx_t_3);
+5614: frq_scl: cython.double = hz2radians(frequency)
__pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_v_frequency); if (unlikely((__pyx_t_2 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 5614, __pyx_L1_error) __pyx_t_4 = __pyx_f_8pysndlib_3clm_hz2radians(__pyx_t_2, 0); if (unlikely(__pyx_t_4 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 5614, __pyx_L1_error) __pyx_v_frq_scl = __pyx_t_4;
+5615: maxdev: cython.double = frq_scl * fm_index
__pyx_t_1 = PyFloat_FromDouble(__pyx_v_frq_scl); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5615, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_5 = PyNumber_Multiply(__pyx_t_1, __pyx_v_fm_index); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 5615, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_t_5); if (unlikely((__pyx_t_4 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 5615, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_v_maxdev = __pyx_t_4;
+5616: index1: cython.double = fm1_index if fm1_index else min(math.pi, maxdev * (5.0 / math.log(frequency)))
__pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_fm1_index); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 5616, __pyx_L1_error) if (__pyx_t_6) { __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_v_fm1_index); if (unlikely((__pyx_t_2 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 5616, __pyx_L1_error) __pyx_t_4 = __pyx_t_2; } else { __pyx_t_5 = PyFloat_FromDouble(__pyx_v_maxdev); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 5616, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_math); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 5616, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_log); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 5616, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_7 = NULL; __pyx_t_9 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_8))) { __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_8); if (likely(__pyx_t_7)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8); __Pyx_INCREF(__pyx_t_7); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_8, function); __pyx_t_9 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_v_frequency}; __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_8, __pyx_callargs+1-__pyx_t_9, 1+__pyx_t_9); __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5616, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; } __pyx_t_8 = __Pyx_PyFloat_TrueDivideCObj(__pyx_float_5_0, __pyx_t_1, 5.0, 0, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 5616, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyNumber_Multiply(__pyx_t_5, __pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5616, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_math); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 5616, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_pi); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 5616, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __pyx_t_7 = PyObject_RichCompare(__pyx_t_1, __pyx_t_5, Py_LT); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 5616, __pyx_L1_error) __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely((__pyx_t_10 < 0))) __PYX_ERR(0, 5616, __pyx_L1_error) __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; if (__pyx_t_10) { __Pyx_INCREF(__pyx_t_1); __pyx_t_8 = __pyx_t_1; } else { __Pyx_INCREF(__pyx_t_5); __pyx_t_8 = __pyx_t_5; } __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_t_8); if (unlikely((__pyx_t_2 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 5616, __pyx_L1_error) __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __pyx_t_4 = __pyx_t_2; } __pyx_v_index1 = __pyx_t_4;
+5617: index2: cython.double = fm2_index if fm2_index else min(math.pi, maxdev * 3.0 * ((8.5 - math.log(frequency)) / (3.0 + (frequency / 1000.))))
__pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_fm2_index); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 5617, __pyx_L1_error) if (__pyx_t_6) { __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_v_fm2_index); if (unlikely((__pyx_t_2 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 5617, __pyx_L1_error) __pyx_t_4 = __pyx_t_2; } else { __pyx_t_8 = PyFloat_FromDouble((__pyx_v_maxdev * 3.0)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 5617, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_math); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 5617, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_log); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 5617, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_5 = NULL; __pyx_t_9 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_7))) { __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_7); if (likely(__pyx_t_5)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7); __Pyx_INCREF(__pyx_t_5); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_7, function); __pyx_t_9 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_v_frequency}; __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_7, __pyx_callargs+1-__pyx_t_9, 1+__pyx_t_9); __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5617, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; } __pyx_t_7 = __Pyx_PyFloat_SubtractCObj(__pyx_float_8_5, __pyx_t_1, 8.5, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 5617, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_PyFloat_TrueDivideObjC(__pyx_v_frequency, __pyx_float_1000_, 1000., 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5617, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_5 = __Pyx_PyFloat_AddCObj(__pyx_float_3_0, __pyx_t_1, 3.0, 0, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 5617, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_PyNumber_Divide(__pyx_t_7, __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5617, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_5 = PyNumber_Multiply(__pyx_t_8, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 5617, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_math); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5617, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_pi); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 5617, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_7 = PyObject_RichCompare(__pyx_t_5, __pyx_t_8, Py_LT); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 5617, __pyx_L1_error) __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely((__pyx_t_10 < 0))) __PYX_ERR(0, 5617, __pyx_L1_error) __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; if (__pyx_t_10) { __Pyx_INCREF(__pyx_t_5); __pyx_t_1 = __pyx_t_5; } else { __Pyx_INCREF(__pyx_t_8); __pyx_t_1 = __pyx_t_8; } __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_2 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 5617, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_4 = __pyx_t_2; } __pyx_v_index2 = __pyx_t_4;
+5618: index3: cython.double = fm3_index if fm3_index else min(math.pi, maxdev * (4.0 / math.sqrt(frequency)))
__pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_fm3_index); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 5618, __pyx_L1_error) if (__pyx_t_6) { __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_v_fm3_index); if (unlikely((__pyx_t_2 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 5618, __pyx_L1_error) __pyx_t_4 = __pyx_t_2; } else { __pyx_t_1 = PyFloat_FromDouble(__pyx_v_maxdev); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5618, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_math); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 5618, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_sqrt); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 5618, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __pyx_t_8 = NULL; __pyx_t_9 = 0; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_7))) { __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7); if (likely(__pyx_t_8)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7); __Pyx_INCREF(__pyx_t_8); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_7, function); __pyx_t_9 = 1; } } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_8, __pyx_v_frequency}; __pyx_t_5 = __Pyx_PyObject_FastCall(__pyx_t_7, __pyx_callargs+1-__pyx_t_9, 1+__pyx_t_9); __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 5618, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; } __pyx_t_7 = __Pyx_PyFloat_TrueDivideCObj(__pyx_float_4_0, __pyx_t_5, 4.0, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 5618, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_5 = PyNumber_Multiply(__pyx_t_1, __pyx_t_7); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 5618, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_math); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 5618, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_pi); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5618, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_8 = PyObject_RichCompare(__pyx_t_5, __pyx_t_1, Py_LT); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 5618, __pyx_L1_error) __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely((__pyx_t_10 < 0))) __PYX_ERR(0, 5618, __pyx_L1_error) __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; if (__pyx_t_10) { __Pyx_INCREF(__pyx_t_5); __pyx_t_7 = __pyx_t_5; } else { __Pyx_INCREF(__pyx_t_1); __pyx_t_7 = __pyx_t_1; } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_t_7); if (unlikely((__pyx_t_2 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 5618, __pyx_L1_error) __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_4 = __pyx_t_2; } __pyx_v_index3 = __pyx_t_4;
+5619: carrier: mus_any = make_oscil(frequency)
__pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_v_frequency); if (unlikely((__pyx_t_4 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 5619, __pyx_L1_error) __pyx_t_11.__pyx_n = 1; __pyx_t_11.frequency = __pyx_t_4; __pyx_t_7 = ((PyObject *)__pyx_f_8pysndlib_3clm_make_oscil(0, &__pyx_t_11)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 5619, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_v_carrier = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_t_7); __pyx_t_7 = 0;
+5620: fmosc1: mus_any = make_oscil(frequency)
__pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_v_frequency); if (unlikely((__pyx_t_4 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 5620, __pyx_L1_error) __pyx_t_11.__pyx_n = 1; __pyx_t_11.frequency = __pyx_t_4; __pyx_t_7 = ((PyObject *)__pyx_f_8pysndlib_3clm_make_oscil(0, &__pyx_t_11)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 5620, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_v_fmosc1 = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_t_7); __pyx_t_7 = 0;
+5621: fmosc2: mus_any = make_oscil(frequency * fm2_rat)
__pyx_t_7 = PyNumber_Multiply(__pyx_v_frequency, __pyx_v_fm2_rat); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 5621, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_t_7); if (unlikely((__pyx_t_4 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 5621, __pyx_L1_error) __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_11.__pyx_n = 1; __pyx_t_11.frequency = __pyx_t_4; __pyx_t_7 = ((PyObject *)__pyx_f_8pysndlib_3clm_make_oscil(0, &__pyx_t_11)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 5621, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_v_fmosc2 = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_t_7); __pyx_t_7 = 0;
+5622: fmosc3: mus_any = make_oscil(frequency * fm3_rat)
__pyx_t_7 = PyNumber_Multiply(__pyx_v_frequency, __pyx_v_fm3_rat); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 5622, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_t_7); if (unlikely((__pyx_t_4 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 5622, __pyx_L1_error) __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_11.__pyx_n = 1; __pyx_t_11.frequency = __pyx_t_4; __pyx_t_7 = ((PyObject *)__pyx_f_8pysndlib_3clm_make_oscil(0, &__pyx_t_11)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 5622, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_v_fmosc3 = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_t_7); __pyx_t_7 = 0;
+5623: ampf: mus_any= make_env(amp_env, scaler = amplitude, duration = dur)
__pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_v_amplitude); if (unlikely((__pyx_t_4 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 5623, __pyx_L1_error) __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_v_dur); if (unlikely((__pyx_t_2 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 5623, __pyx_L1_error) __pyx_t_12.__pyx_n = 2; __pyx_t_12.scaler = __pyx_t_4; __pyx_t_12.duration = __pyx_t_2; __pyx_t_7 = ((PyObject *)__pyx_f_8pysndlib_3clm_make_env(__pyx_v_amp_env, 0, &__pyx_t_12)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 5623, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_v_ampf = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_t_7); __pyx_t_7 = 0;
+5624: indf1: mus_any= make_env(fm1_env, scaler = index1, duration = dur)
__pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_v_dur); if (unlikely((__pyx_t_2 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 5624, __pyx_L1_error) __pyx_t_12.__pyx_n = 2; __pyx_t_12.scaler = __pyx_v_index1; __pyx_t_12.duration = __pyx_t_2; __pyx_t_7 = ((PyObject *)__pyx_f_8pysndlib_3clm_make_env(__pyx_v_fm1_env, 0, &__pyx_t_12)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 5624, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_v_indf1 = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_t_7); __pyx_t_7 = 0;
+5625: indf2: mus_any= make_env(fm2_env, scaler = index2, duration = dur)
__pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_v_dur); if (unlikely((__pyx_t_2 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 5625, __pyx_L1_error) __pyx_t_12.__pyx_n = 2; __pyx_t_12.scaler = __pyx_v_index2; __pyx_t_12.duration = __pyx_t_2; __pyx_t_7 = ((PyObject *)__pyx_f_8pysndlib_3clm_make_env(__pyx_v_fm2_env, 0, &__pyx_t_12)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 5625, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_v_indf2 = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_t_7); __pyx_t_7 = 0;
+5626: indf3: mus_any= make_env(fm3_env, scaler = index3, duration = dur)
__pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_v_dur); if (unlikely((__pyx_t_2 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 5626, __pyx_L1_error) __pyx_t_12.__pyx_n = 2; __pyx_t_12.scaler = __pyx_v_index3; __pyx_t_12.duration = __pyx_t_2; __pyx_t_7 = ((PyObject *)__pyx_f_8pysndlib_3clm_make_env(__pyx_v_fm3_env, 0, &__pyx_t_12)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 5626, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_v_indf3 = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_t_7); __pyx_t_7 = 0;
+5627: frqf: mus_any= make_env(gliss_env, (glissando_amount * frq_scl), duration=dur)
__pyx_t_7 = PyFloat_FromDouble(__pyx_v_frq_scl); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 5627, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_5 = PyNumber_Multiply(__pyx_v_glissando_amount, __pyx_t_7); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 5627, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_t_5); if (unlikely((__pyx_t_2 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 5627, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_v_dur); if (unlikely((__pyx_t_4 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 5627, __pyx_L1_error) __pyx_t_12.__pyx_n = 2; __pyx_t_12.scaler = __pyx_t_2; __pyx_t_12.duration = __pyx_t_4; __pyx_t_5 = ((PyObject *)__pyx_f_8pysndlib_3clm_make_env(__pyx_v_gliss_env, 0, &__pyx_t_12)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 5627, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_v_frqf = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_t_5); __pyx_t_5 = 0;
+5628: pervib: mus_any= make_triangle_wave(periodic_vibrato_rate,periodic_vibrato_amplitude * frq_scl)
__pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_v_periodic_vibrato_rate); if (unlikely((__pyx_t_4 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 5628, __pyx_L1_error) __pyx_t_5 = PyFloat_FromDouble(__pyx_v_frq_scl); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 5628, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_7 = PyNumber_Multiply(__pyx_v_periodic_vibrato_amplitude, __pyx_t_5); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 5628, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_t_7); if (unlikely((__pyx_t_2 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 5628, __pyx_L1_error) __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_13.__pyx_n = 1; __pyx_t_13.amplitude = __pyx_t_2; __pyx_t_7 = ((PyObject *)__pyx_f_8pysndlib_3clm_make_triangle_wave(__pyx_t_4, 0, &__pyx_t_13)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 5628, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_v_pervib = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_t_7); __pyx_t_7 = 0;
+5629: ranvib: mus_any= make_rand_interp(random_vibrato_rate, random_vibrato_amplitude * frq_scl)
__pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_v_random_vibrato_rate); if (unlikely((__pyx_t_2 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 5629, __pyx_L1_error) __pyx_t_7 = PyFloat_FromDouble(__pyx_v_frq_scl); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 5629, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_5 = PyNumber_Multiply(__pyx_v_random_vibrato_amplitude, __pyx_t_7); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 5629, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_t_5); if (unlikely((__pyx_t_4 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 5629, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_14.__pyx_n = 1; __pyx_t_14.amplitude = __pyx_t_4; __pyx_t_5 = ((PyObject *)__pyx_f_8pysndlib_3clm_make_rand_interp(__pyx_t_2, 0, &__pyx_t_14)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 5629, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_v_ranvib = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_t_5); __pyx_t_5 = 0;
+5630: fm_noi: mus_any= make_rand(noise_freq, math.pi * noise_amount)
__pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_v_noise_freq); if (unlikely((__pyx_t_4 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 5630, __pyx_L1_error) __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_math); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 5630, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_pi); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 5630, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_5 = PyNumber_Multiply(__pyx_t_7, __pyx_v_noise_amount); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 5630, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_t_5); if (unlikely((__pyx_t_2 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 5630, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_15.__pyx_n = 1; __pyx_t_15.amplitude = __pyx_t_2; __pyx_t_5 = ((PyObject *)__pyx_f_8pysndlib_3clm_make_rand(__pyx_t_4, 0, &__pyx_t_15)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 5630, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_v_fm_noi = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_t_5); __pyx_t_5 = 0;
+5631: ind_noi: mus_any= make_rand_interp(ind_noise_freq, ind_noise_amount)
__pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_v_ind_noise_freq); if (unlikely((__pyx_t_2 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 5631, __pyx_L1_error) __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_v_ind_noise_amount); if (unlikely((__pyx_t_4 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 5631, __pyx_L1_error) __pyx_t_14.__pyx_n = 1; __pyx_t_14.amplitude = __pyx_t_4; __pyx_t_5 = ((PyObject *)__pyx_f_8pysndlib_3clm_make_rand_interp(__pyx_t_2, 0, &__pyx_t_14)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 5631, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_v_ind_noi = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_t_5); __pyx_t_5 = 0;
+5632: amp_noi: mus_any= make_rand_interp(amp_noise_freq, amp_noise_amount)
__pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_v_amp_noise_freq); if (unlikely((__pyx_t_4 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 5632, __pyx_L1_error) __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_v_amp_noise_amount); if (unlikely((__pyx_t_2 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 5632, __pyx_L1_error) __pyx_t_14.__pyx_n = 1; __pyx_t_14.amplitude = __pyx_t_2; __pyx_t_5 = ((PyObject *)__pyx_f_8pysndlib_3clm_make_rand_interp(__pyx_t_4, 0, &__pyx_t_14)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 5632, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_v_amp_noi = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_t_5); __pyx_t_5 = 0;
+5633: loc: mus_any = make_locsig(degree, distance, reverb_amount)
__pyx_t_16.__pyx_n = 3; __pyx_t_16.degree = __pyx_v_degree; __pyx_t_16.distance = __pyx_v_distance; __pyx_t_16.reverb = __pyx_v_reverb_amount; __pyx_t_5 = ((PyObject *)__pyx_f_8pysndlib_3clm_make_locsig(0, &__pyx_t_16)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 5633, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_v_loc = ((struct __pyx_obj_8pysndlib_3clm_mus_any *)__pyx_t_5); __pyx_t_5 = 0;
5634:
5635: i: cython.int
5636:
+5637: for i in range(start, end):
__pyx_t_9 = __pyx_v_end;
__pyx_t_17 = __pyx_t_9;
for (__pyx_t_18 = __pyx_v_start; __pyx_t_18 < __pyx_t_17; __pyx_t_18+=1) {
__pyx_v_i = __pyx_t_18;
+5638: vib: cython.double = triangle_wave(pervib) + rand_interp(ranvib) + env(frqf)
__pyx_t_2 = __pyx_f_8pysndlib_3clm_triangle_wave(__pyx_v_pervib, 0, NULL); if (unlikely(__pyx_t_2 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 5638, __pyx_L1_error) __pyx_t_5 = PyFloat_FromDouble(__pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 5638, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_7 = __pyx_f_8pysndlib_3clm_rand_interp(__pyx_v_ranvib, 0, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 5638, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_1 = PyNumber_Add(__pyx_t_5, __pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5638, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_2 = __pyx_f_8pysndlib_3clm_env(__pyx_v_frqf, 0); if (unlikely(__pyx_t_2 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 5638, __pyx_L1_error) __pyx_t_7 = PyFloat_FromDouble(__pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 5638, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_5 = PyNumber_Add(__pyx_t_1, __pyx_t_7); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 5638, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_t_5); if (unlikely((__pyx_t_2 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 5638, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_v_vib = __pyx_t_2;
+5639: fuzz: cython.double = rand(fm_noi)
__pyx_t_2 = __pyx_f_8pysndlib_3clm_rand(__pyx_v_fm_noi, 0, NULL); if (unlikely(__pyx_t_2 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 5639, __pyx_L1_error) __pyx_v_fuzz = __pyx_t_2;
+5640: inoi: cython.double = 1.0 + rand_interp(ind_noi)
__pyx_t_5 = __pyx_f_8pysndlib_3clm_rand_interp(__pyx_v_ind_noi, 0, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 5640, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_7 = __Pyx_PyFloat_AddCObj(__pyx_float_1_0, __pyx_t_5, 1.0, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 5640, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_t_7); if (unlikely((__pyx_t_2 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 5640, __pyx_L1_error) __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_v_inoi = __pyx_t_2;
+5641: anoi: cython.double = env(ampf) * (1.0 + rand_interp(amp_noi))
__pyx_t_2 = __pyx_f_8pysndlib_3clm_env(__pyx_v_ampf, 0); if (unlikely(__pyx_t_2 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 5641, __pyx_L1_error) __pyx_t_7 = PyFloat_FromDouble(__pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 5641, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_5 = __pyx_f_8pysndlib_3clm_rand_interp(__pyx_v_amp_noi, 0, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 5641, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_1 = __Pyx_PyFloat_AddCObj(__pyx_float_1_0, __pyx_t_5, 1.0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5641, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_5 = PyNumber_Multiply(__pyx_t_7, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 5641, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_t_5); if (unlikely((__pyx_t_2 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 5641, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_v_anoi = __pyx_t_2;
+5642: locsig(loc, i, anoi * oscil(carrier,
/* "pysndlib/clm.pyx":5642
* inoi: cython.double = 1.0 + rand_interp(ind_noi)
* anoi: cython.double = env(ampf) * (1.0 + rand_interp(amp_noi))
* locsig(loc, i, anoi * oscil(carrier, # <<<<<<<<<<<<<<
* vib +
* inoi *
*/
__pyx_t_20.__pyx_n = 1;
__pyx_t_20.fm = (__pyx_v_vib + (__pyx_v_inoi * (((__pyx_t_2 * __pyx_t_19) + (__pyx_t_4 * __pyx_t_22)) + (__pyx_t_21 * __pyx_t_24))));
__pyx_t_23 = __pyx_f_8pysndlib_3clm_oscil(__pyx_v_carrier, 0, &__pyx_t_20); if (unlikely(__pyx_t_23 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 5642, __pyx_L1_error)
__pyx_t_24 = __pyx_f_8pysndlib_3clm_locsig(__pyx_v_loc, __pyx_v_i, (__pyx_v_anoi * __pyx_t_23), 0); if (unlikely(__pyx_t_24 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 5642, __pyx_L1_error)
}
5643: vib +
5644: inoi *
+5645: ((env(indf1) * oscil(fmosc1, (vib * fm1_rat) + fuzz)) +
__pyx_t_2 = __pyx_f_8pysndlib_3clm_env(__pyx_v_indf1, 0); if (unlikely(__pyx_t_2 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 5645, __pyx_L1_error) __pyx_t_5 = PyFloat_FromDouble(__pyx_v_vib); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 5645, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_1 = PyNumber_Multiply(__pyx_t_5, __pyx_v_fm1_rat); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5645, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_5 = PyFloat_FromDouble(__pyx_v_fuzz); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 5645, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_7 = PyNumber_Add(__pyx_t_1, __pyx_t_5); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 5645, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_t_7); if (unlikely((__pyx_t_4 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 5645, __pyx_L1_error) __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_20.__pyx_n = 1; __pyx_t_20.fm = __pyx_t_4; __pyx_t_19 = __pyx_f_8pysndlib_3clm_oscil(__pyx_v_fmosc1, 0, &__pyx_t_20); if (unlikely(__pyx_t_19 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 5645, __pyx_L1_error)
+5646: (env(indf2) * oscil(fmosc2, ((vib * fm2_rat) + fuzz))) +
__pyx_t_4 = __pyx_f_8pysndlib_3clm_env(__pyx_v_indf2, 0); if (unlikely(__pyx_t_4 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 5646, __pyx_L1_error) __pyx_t_7 = PyFloat_FromDouble(__pyx_v_vib); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 5646, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_5 = PyNumber_Multiply(__pyx_t_7, __pyx_v_fm2_rat); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 5646, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_7 = PyFloat_FromDouble(__pyx_v_fuzz); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 5646, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_1 = PyNumber_Add(__pyx_t_5, __pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5646, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_21 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_21 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 5646, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_20.__pyx_n = 1; __pyx_t_20.fm = __pyx_t_21; __pyx_t_22 = __pyx_f_8pysndlib_3clm_oscil(__pyx_v_fmosc2, 0, &__pyx_t_20); if (unlikely(__pyx_t_22 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 5646, __pyx_L1_error)
+5647: (env(indf3) * oscil(fmosc3, ((vib * fm3_rat) + fuzz))))))
__pyx_t_21 = __pyx_f_8pysndlib_3clm_env(__pyx_v_indf3, 0); if (unlikely(__pyx_t_21 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 5647, __pyx_L1_error) __pyx_t_1 = PyFloat_FromDouble(__pyx_v_vib); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5647, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_7 = PyNumber_Multiply(__pyx_t_1, __pyx_v_fm3_rat); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 5647, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyFloat_FromDouble(__pyx_v_fuzz); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5647, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_5 = PyNumber_Add(__pyx_t_7, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 5647, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_23 = __pyx_PyFloat_AsDouble(__pyx_t_5); if (unlikely((__pyx_t_23 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 5647, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_20.__pyx_n = 1; __pyx_t_20.fm = __pyx_t_23; __pyx_t_24 = __pyx_f_8pysndlib_3clm_oscil(__pyx_v_fmosc3, 0, &__pyx_t_20); if (unlikely(__pyx_t_24 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 5647, __pyx_L1_error)
5648:
5649:
5650: # cpdef np.ndarray fill_array(arr: npt.NDArray[np.float64], gen: mus_any, arg1: cython.double=0.0, arg2: cython.double=0.0):
5651: # check_ndim(arr)
5652: # arr_length = len(arr)
5653: # cdef i = 0
5654: # for i in range(arr_length):
5655: # arr[i] = cclm.mus_apply(gen._ptr, arg1,arg2)
5656:
5657:
5658: # @cython.ccall
5659: # def ppadd(n: cython.int) -> cython.int:
5660: # i: cython.int = 0
5661: # k: cython.int = 0
5662: # for i in range(n):
5663: # k += 1
5664: # return k
5665:
5666:
5667: # cdef nbd = [
5668: # [1.0, 0.0, 0.0425, 0.3, 1.0 ], # hum (-2 octave)
5669: # [1.000710732054, 0.0, 0.14083333333333, 0.3, 1.0 ],
5670: # [1.6958066808813, 0.0, 0.25416666666667, 0.3, 0.46153846153846 ], # prime (-1 octave)
5671: # [1.6966595593461, 0.0, 0.70416666666667, 0.3, 0.46153846153846 ], # tierce
5672: # [2.2359630419332, 0.0, 0.79166666666667, 0.0, 0.17142857142857 ], # quint
5673: # [2.9168443496802, 0.083333333333333, 0.031666666666667, 0.25, 0.08 ], # nominal
5674: # [3.7029140014215, 1.0, 0.25, 0.1, 0.34285714285714 ],
5675: # [4.3918123667377, 0.0, 0.29166666666667, 0.15, 0.1 ],
5676: # [4.3951670220327, 0.0, 0.15, 0.15, 0.066666666666667 ],
5677: # [4.680881307747, 0.14166666666667, 0.041666666666667, 0.0, 0.06 ],
5678: # [5.455579246624, 0.29166666666667, 0.10833333333333, 0.5, 0.12 ],
5679: # [6.1961620469083, 0.083333333333333, 0.025, 0.3, 0.12 ],
5680: # [7.0717839374556, 0.0, 0.10833333333333, 0.05, 0.12 ],
5681: # [7.3546552949538, 0.0, 0.19166666666667, 0.0, 0.048 ],
5682: # [7.407249466951, 0.15, 0.061666666666667, 0.11, 0.13333333333333 ],
5683: # [7.4103766879886, 0.058333333333333, 0.025, 0.11, 0.13333333333333 ],
5684: # [9.4015636105188, 0.0, 0.045833333333333, 0.0, 0.034285714285714 ],
5685: # [9.498223169865, 0.18333333333333, 0.15, 0.25, 0.024 ],
5686: # [11.674484719261, 0.05, 0.0083333333333333, 0.5, 0.08 ],
5687: # [13.384506041222, 0.010416666666667, 0.00625, 0.05, 0.024 ],
5688: # [13.890547263682, 0.021666666666667, 0.021666666666667, 0.1, 0.08 ],
5689: # [16.136460554371, 0.0125, 0.0041666666666667, 0.07, 0.1 ]
5690: # ]
5691: #
5692: # cpdef bell(beg:cython.double, dur: cython.double=8, freq: cython.double=351.75, amp: cython.double=0.3, deg: cython.double=45., dist: cython.double=0.0, rev:cython.double=0.0):
5693: # cdef cython.int start = seconds2samples(beg)
5694: # cdef cython.int end = start + seconds2samples(dur)
5695: # cdef mus_any location = make_locsig(degree=deg, distance=dist, reverb=rev)
5696: #
5697: # oscils_freqs_radians, envarray = [], []
5698: #
5699: # for b in nbd:
5700: # hertz = round(b[0] * freq, 3)
5701: # splashamp = round(b[1] * amp, 3)
5702: # tailamp = round(b[2] * amp, 3)
5703: # attack = round( b[3] if b[3] else .001, 3)
5704: # decay = round(b[4] * dur, 3)
5705: # # convert sc's envelope format [yyy][xxx] to sndlib's [xyxyxy]
5706: # # Env.new([splashamp, tailamp*(2/3), tailamp, 0], [attack*(1/4), attack*(3/4), decay], 'sin');
5707: # # X Y
5708: # envl = [0, splashamp,
5709: # attack*(1/4), tailamp*(2/3),
5710: # attack*(1/4)+attack*(3/4), tailamp,
5711: # attack*(1/4)+attack*(3/4)+decay, 0]
5712: # #print("SC:", [[round(attack*(1/4), 3) , round(attack*(3/4), 3), round(decay, 3)],
5713: # # [round(splashamp, 3), round(tailamp*(2/3), 3), round(tailamp, 3), 0]])
5714: # #print("PY:", envl)
5715: # #plotenv(envl)
5716: #
5717: # envarray.append(make_env(envl, scaler=amp, duration=dur))
5718: #
5719: # #freqs in radians
5720: # oscils_freqs_radians.append(hz2radians(hertz) )
5721: #
5722: # # use oscil bank instead of python array of oscils
5723: # # starting phase. i am going to change make_oscil_bank so if you want all the values to just start at a
5724: # # certain phase you can just pass a scaler. i meant it to work that way but screwed it up
5725: #
5726: # cdef cython.double [:] starting_phases_ndarray = np.zeros(len(oscils_freqs_radians))
5727: # # if an numpy array is used here the oscil_bank holds on to the array and any changes to it will
5728: # # impact the underlying processing.
5729: # cdef cython.double [:] amps_ndarray = np.zeros(len(oscils_freqs_radians))
5730: # cdef mus_any oscils = make_oscil_bank(oscils_freqs_radians, starting_phases_ndarray, amps_ndarray)
5731: #
5732: # # don't know if these save much to compute this once
5733: # osc_bank_len = len(oscils_freqs_radians)
5734: #
5735: # # cdef int i = 0
5736: #
5737: # for cdef int i in range(start, end):
5738: # for j in range(osc_bank_len):
5739: # amps_ndarray[j] = env(envarray[j])
5740: # locsig(location, i, oscil_bank(oscils))
5741: #
5742: #
5743: #
5744: #
5745: #
5746: #
5747:
5748:
5749:
5750:
5751: #########################################
5752: # basic file reading/writing to/from nympy arrays
5753: # note all of this assumes numpy dtype is np.double
5754: # also assumes shape is (chan, length)
5755: # a mono file that is 8000 samples long should
5756: # be a numpy array created with something like
5757: # arr = np.zeroes((1,8000), dtype=np.double)
5758: # librosa follows this convention
5759: # todo : look at allowing something like np.zeroes((8000), dtype=np.double)
5760: # to just be treated as mono sound buffer
5761: # the python soundfile library does this differently
5762: # and would use
5763: # arr = np.zeros((8000,1), dtype=np.double))
5764: # this seems less intuitive to me
5765: # very issue to translate with simple np.transpose()
5766:
5767:
5768: # cpdef sndinfo(filename):
5769: # """returns a dictionary of info about a sound file including write date (data), sample rate (srate),
5770: # channels (chans), length in samples (samples), length in second (length), comment (comment), and loop information (loopinfo)"""
5771: # date = csndlib.mus_sound_write_date(filename)
5772: # srate = csndlib.mus_sound_srate(filename)
5773: # chans = csndlib.mus_sound_chans(filename)
5774: # samples = csndlib.mus_sound_samples(filename)
5775: # comment = csndlib.mus_sound_comment(filename)
5776: # length = samples / (chans * srate)
5777: #
5778: # header_type = header(mus_sound_header_type(filename))
5779: # sample_type = sample(mus_sound_sample_type(filename))
5780: #
5781: # loop_info = mus_sound_loop_info(filename)
5782: # if loop_info:
5783: # loop_modes = [loop_info[6], loop_info[7]]
5784: # loop_starts = [loop_info[0], loop_info[2]]
5785: # loop_ends = [loop_info[1], loop_info[3]]
5786: # base_note = loop_info[4]
5787: # base_detune = loop_info[5]
5788: #
5789: # loop_info = {'sustain_start' : loop_starts[0], 'sustain_end' : loop_ends[0],
5790: # 'release_start' : loop_starts[2], 'release_end' : loop_ends[1],
5791: # 'base_note' : base_note, 'base_detune' : base_detune,
5792: # 'sustain_mode' : loop_modes[0], 'release_mode' : loop_modes[1]}
5793: #
5794: # info = {'date' : time.localtime(date), 'srate' : srate, 'chans' : chans, 'samples' : samples,
5795: # 'comment' : comment, 'length' : length, 'header_type' : header_type, 'sample_type' : sample_type,
5796: # 'loop_info' : loop_info}
5797: # return info
5798:
5799: # def sound_loop_info(filename):
5800: # """returns a dictionary of info about a sound file including write date (data), sample rate (srate),
5801: # channels (chans), length in samples (samples), length in second (length), comment (comment), and loop information (loopinfo)"""
5802: #
5803: # loop_info = sndlib.mus_sound_loop_info(filename)
5804: # if loop_info:
5805: # loop_modes = [loop_info[6], loop_info[7]]
5806: # loop_starts = [loop_info[0], loop_info[2]]
5807: # loop_ends = [loop_info[1], loop_info[3]]
5808: # base_note = loop_info[4]
5809: # base_detune = loop_info[5]
5810: #
5811: # loop_info = {'sustain_start' : loop_starts[0], 'sustain_end' : loop_ends[0],
5812: # 'release_start' : loop_starts[2], 'release_end' : loop_ends[1],
5813: # 'base_note' : base_note, 'base_detune' : base_detune,
5814: # 'sustain_mode' : loop_modes[0], 'release_mode' : loop_modes[1]}
5815: # return info
5816: #
5817: # cpdef np.ndarray file2array(filename: str, channel: Optional[int]=0, beg: Optional[int]=None, dur: Optional[int]=None):
5818: # """
5819: # return an ndarray with samples from file
5820: # """
5821: # length = dur or csndlib.mus_sound_framples(filename)
5822: # chans = csndlib.mus_sound_chans(filename)
5823: # srate = csndlib.mus_sound_srate(filename)
5824: # bg = beg or 0
5825: # out = np.zeros(length, dtype=np.double)
5826: #
5827: # cdef double [:] out_view = None
5828: # out_view = out
5829: #
5830: # csndlib.mus_file_to_array(filename,channel, bg, length, &out_view[0])
5831: # return out
5832: #
5833: # def channel2array(filename: str, channel: Optional[int]=0, beg: Optional[int]=None, dur: Optional[int]=None):
5834: # length = dur or mus_sound_framples(filename)
5835: # srate = mus_sound_srate(filename)
5836: # bg = beg or 0
5837: # out = np.zeros((1, length), dtype=np.double)
5838: # mus_file_to_array(filename,channel, bg, length, out[0].ctypes.data_as(ctypes.pointer(ctypes.c_double)))
5839: # return out
5840: #
5841: # def calc_length(start, dur):
5842: # st = seconds2samples(start)
5843: # nd = seconds2samples(start+dur)
5844: # return st, nd
5845: #